简体   繁体   中英

A question regarding LATLNG package & LatLng type in Flutter

LATLNG giving The argument type 'LatLng' can't be assigned to the parameter type 'LatLng'

The argument type 'LatLng (where LatLng is defined in E:\flutter.pub-cache\hosted\pub.dartlang.org\latlong2-0.8.0\lib\latlong\LatLng.dart)' can't be assigned to the parameter type 'LatLng (where LatLng is defined in E:\flutter.pub-cache\hosted\pub.dartlang.org\latlong-0.6.1\lib\latlong\LatLng.dart)'

Below are the dependencies with the commented out ones not in use.

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  font_awesome_flutter: ^8.11.0
  flutter:
    sdk: flutter

  firebase_core: ^0.7.0
  firebase_analytics: ^7.0.1
  firebase_auth: ^0.20.0+1
  cloud_firestore: ^0.16.0
  firebase_storage: ^7.0.0
  readmore: ^2.0.0
  google_fonts: ^1.1.1
  google_sign_in: "^4.5.1"
  flutter_login_facebook: ^0.4.2+3

  # mapbox_gl: ^0.10.0
  location: ^4.3.0
  provider: ^4.3.3
  image_picker: ^0.6.7+3
  image_cropper: ^1.4.0
  shared_preferences: ^0.5.3+4
  # geolocator: 6.2.1
  intl: ^0.16.1
  http: ^0.12.0+2
  geocoding: ^2.0.0
  # geocoder: ^0.2.1
  flutter_map: ^0.12.0
  # latlong: ^0.8.0

  # geoflutterfire: ^2.2.2

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_launcher_icons: ^0.8.1

As a maintainer of flutter_map , this is what you should do:

  1. Depend on the latest version of 'latlong2' as usual
  2. Import it into all necessary files

'flutter_map' used to export this library automatically for you, but does not any more. Besides, it is now recommended by Dart to depend on all used packages, whether or not they are exported by others.

This has been added to the documentation website as of v1.1.1.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM