Skip to content

Commit

Permalink
[web] Fix build failure due to http package upgrade (#550)
Browse files Browse the repository at this point in the history
* [web] Fix build failure due to http package upgrade

* No need to pin http package version
  • Loading branch information
shroff authored Feb 20, 2021
1 parent 1ef1d58 commit 7950192
Showing 1 changed file with 5 additions and 4 deletions.
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

0 comments on commit 7950192

Please sign in to comment.