Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[web] Fix build failure due to http package upgrade #550

Merged
merged 2 commits into from
Feb 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions example/lib/place_symbol.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
// found in the LICENSE file.

import 'dart:async';
import 'dart:core';
import 'dart:math';
import 'dart:typed_data';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:http/http.dart';
import 'package:http/http.dart' as http;
import 'package:mapbox_gl/mapbox_gl.dart';

import 'main.dart';
Expand Down Expand Up @@ -47,7 +48,7 @@ class PlaceSymbolBodyState extends State<PlaceSymbolBody> {

void _onStyleLoaded() {
addImageFromAsset("assetImage", "assets/symbols/custom-icon.png");
addImageFromUrl("networkImage", "https://via.placeholder.com/50");
addImageFromUrl("networkImage", Uri.parse("https://via.placeholder.com/50"));
}

@override
Expand All @@ -64,8 +65,8 @@ class PlaceSymbolBodyState extends State<PlaceSymbolBody> {
}

/// Adds a network image to the currently displayed style
Future<void> addImageFromUrl(String name, String url) async {
var response = await get(url);
Future<void> addImageFromUrl(String name, Uri uri) async {
var response = await http.get(uri);
return controller.addImage(name, response.bodyBytes);
}

Expand Down