flutter widget: flutter_map don't work, missing latLng function

Viewed 70

I want o test this (https://pub.dev/packages/flutter_map) widget map from Flutter. but i can found what to import to solve dependency to this method: LatLng.

This method is used to set a point on many places on the first example. Can someone tell me what lib to import to solve this dependency?

1 Answers

Short answer:

Install latlong2 package simply by doing flutter pub add latlong2


Long answer:

On the right side of pub.dev you can find a dependency list, in this case it's this:

enter image description here

You should already be able to do import 'package:latlong2/latlong.dart'; but probably the linter will notify you not to use dependencies that are not defined in your pubspec.yaml, so you have to explicitly add latlong2: ^x.x.x to your pubspec.

Related