Home > Mobile >  flutter location package version conflict with google_map_location_picker
flutter location package version conflict with google_map_location_picker

Time:07-01

I download a source code from codecanyone but I am facing the following issue when adding google_map_location_picker package

Because location 4.3.0 depends on location_platform_interface ^2.3.0 and no versions of location_platform_interface match >2.3.0 <3.0.0, location 4.3.0 requires location_platform_interface 2.3.0. And because location_platform_interface 2.3.0 depends on plugin_platform_interface ^2.0.0 and geolocator_platform_interface <2.0.0-nullsafety.0 depends on plugin_platform_interface ^1.0.2, location 4.3.0 is incompatible with geolocator_platform_interface <2.0.0-nullsafety.0. And because google_map_location_picker >=4.1.3 depends on geolocator ^6.1.14 which depends on geolocator_platform_interface ^1.0.8, location 4.3.0 is incompatible with google_map_location_picker >=4.1.3. So, because markets depends on both google_map_location_picker 4.1.7 and location 4.3.0, version solving failed. pub get failed (1; So, because markets depends on both google_map_location_picker 4.1.7 and location 4.3.0, version solving failed.)

here is my pubspec.yaml file

name: markets
description: markets

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a  .
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 2.2.0

environment:
  sdk: ">=2.2.2 <3.0.0"
module:
  androidX: true
dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: 1.0.4
  google_maps_flutter: 2.1.1
  google_map_location_picker: 4.1.7
  mvc_pattern: 6.6.4 2
  global_configuration: 2.0.0-nullsafety.1
  html: 0.15.0
  shared_preferences: 2.0.13
  flutter_html: 3.0.0-alpha.2
  flutter_svg: 1.0.3
  location: 4.3.0
  webview_flutter: 3.0.0
  url_launcher: 6.0.20
  cached_network_image: 3.2.0
  fluttertoast: 8.0.8
  flutter_staggered_grid_view: 0.4.0-nullsafety.3
  intl_utils: 2.6.1
  carousel_slider: 4.0.0
  cloud_firestore: 3.1.8
  firebase_auth: 3.3.7
  firebase_core: 1.12.0
  firebase_messaging: 11.2.6
  firebase_storage: 8.0.0
  image_picker: 0.7.5 4
  string_validator: 0.3.0
  platform: 3.1.0


dev_dependencies:
  flutter_test:
    sdk: flutter

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - assets/cfg/
    - assets/img/

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  fonts:
    - family: ProductSans
      fonts:
        - asset: assets/fonts/ProductSans-Thin.ttf
          weight: 100
        - asset: assets/fonts/ProductSans-Thin.ttf
          weight: 200
        - asset: assets/fonts/ProductSans-Light.ttf
          weight: 300
        - asset: assets/fonts/ProductSans-Regular.ttf
          weight: 400
        - asset: assets/fonts/ProductSans-Medium.ttf
          weight: 500
        - asset: assets/fonts/ProductSans-Bold.ttf
          weight: 600
        - asset: assets/fonts/ProductSans-Black.ttf
          weight: 700
        - asset: assets/fonts/ProductSans-Black.ttf
          weight: 800
        - asset: assets/fonts/ProductSans-Black.ttf
          weight: 900
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: assets/fonts/TrajanPro.ttf
  #       - asset: assets/fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-assets/fonts/#from-packages
flutter_intl:
  enabled: true

CodePudding user response:

You've just stumbled upon a Dependency Hell. google_map_location_picker is pretty old now (16 months already) and it uses outdated versions of other packages that some dependencies from the pubspec.yaml depends on itself.

If you remove google_map_location_picker from the dependencies everything installs smoothly. Your best option then would be to fork google_map_location_picker and change the dependencies yourself and point its dependency in the pubspec.yaml to this fork of yours.

To add the fork as a dependency, for example from Github, do something like this:

dependencies:
  flutter:
    sdk: flutter

  carousel_pro:
    git:
      url: git://github.com/your_account/google_map_location_picker_fork.git
      ref: main # branch name
  • Related