Flutter_map: Unable to run basic example

Created on 24 Sep 2018  路  1Comment  路  Source: fleaflet/flutter_map

Hi,
I'm not able to run the basic example provided by the documentation I'm under the ^0.1.4 and I tested with different versions.

I am a beginner with Dart may I have done something wrong ?
here the basic example

```dart
class MapPage extends StatefulWidget {
@override
State createState() => new MapPageState();
}

class MapPageState extends State {
Widget build(BuildContext context) {
return new FlutterMap(
options: new MapOptions(
center: new LatLng(50.5, 30.51),
zoom: 13.0,
),
layers: [
new TileLayerOptions(
urlTemplate: "https://api.tiles.mapbox.com/v4/"
"{id}/{z}/{x}/{y}@2x.png?access_token={accessToken}",
additionalOptions: {
'accessToken': 'MYTOKENxxxxxxx',
'id': 'mapbox.streets',
},
),
new MarkerLayerOptions(
markers: [
new Marker(
width: 80.0,
height: 80.0,
point: new LatLng(51.5, -0.09),
builder: (ctx) =>
new Container(
child: new FlutterLogo(),
),
),
],
),
],
);
}
}```

error: The constructor returns type 'dynamic' that isn't of expected type 'LatLng'. (strong_mode_invalid_cast_new_expr at ...)

Most helpful comment

fixed by adding in import:
import 'package:latlong/latlong.dart';

>All comments

fixed by adding in import:
import 'package:latlong/latlong.dart';

Was this page helpful?
0 / 5 - 0 ratings