Search code examples
flutterflutter-dependencies

Flutter: packages dependencies conflict


I have a Flutter app that I haven't updated for a while. There was a package (package_info_plus) that I needed to update from 1.4.2 to 4.0.2. Right now, I have an issue with it, and this is already fixed in newer versions (more info).

The problem is that other packages need to be updated as well, and with them, some others. I have tried to update everything, but some of them are just not possible to update, blocking the rest.

This is the list with all packages I could update:

environment:
  sdk: '>=3.0.6 <4.0.0'

dependencies:
  line_icons: ^2.0.3
  maps_launcher: ^2.2.0 # REMOVED, USE OTHER INSTEAD
  uuid: ^3.0.7 # IDs for events
  cloudinary_public: ^0.21.0
  showcaseview: ^2.0.3 # help for new users
  provider: ^6.0.5
  cloud_firestore: ^4.8.4
  firebase_core: ^2.15.0 # needs Runner/GoogleService-Info.plist
  firebase_auth: ^4.7.2 # needs Runner/GoogleService-Info.plist
  firebase_analytics: ^10.4.4 # needs Runner/GoogleService-Info.plist
  google_sign_in: ^6.1.4 # needs Info.plist modification
  badges: ^3.1.1
  flutter_translate: ^4.0.4
  sign_in_with_apple: ^5.0.0 # needs Xcode modification https://pub.dev/packages/sign_in_with_apple
  shared_preferences: ^2.2.0
  jiffy: ^6.2.1 # date manipulation
  permission_handler: ^10.4.3 # needs Info.plist modification
  csv: ^5.0.2
  path_provider: ^2.0.15
  flutter_email_sender: ^6.0.1
  flutter_launcher_icons: ^0.13.1
  image_picker: ^1.0.1 # for camera
  image: ^4.0.17
  url_launcher: ^6.1.12 # needs Info.plist modification
  transparent_image: ^2.0.1
  cached_network_image: ^3.2.3
  carousel_slider: ^4.2.1
  flutter_slidable: ^3.0.0
  flutter_svg: ^2.0.7
  table_calendar: ^3.0.9
  add_2_calendar: ^2.2.4 # Info.plist modification
  in_app_purchase: ^3.1.7 # official one.
  flutter_platform_widgets: ^3.3.5
  flutter_native_splash: ^2.3.1
  intl_phone_number_input: ^0.7.3+1
  country_pickers: ^2.0.0
  currency_picker: ^2.0.16
  reorderables: ^0.6.0 # reorder rent fields
  pdf: ^3.10.4
  printing: ^5.11.0 # necessary for the above one
  open_file_safe: ^3.2.3 # necessary for the above one
  fimber: ^0.7.0
  fluttercontactpicker: ^4.7.0
  contacts_service: ^0.6.3 # get contacts. Info.plist modification
  stack_appodeal_flutter: ^3.0.2
  firebase_messaging: ^14.6.5
  firebase_performance: ^0.9.2+4
  after_layout: ^1.2.0
  timezone: ^0.9.2

Followed by the ones I had problems with:

#  flutter_local_notifications: ^12.0.0
  device_info_plus: ^4.0.0
  package_info_plus: ^1.4.2
  file_picker: ^4.2.7 # for multiple images selection
#  intl: ^0.18.0 # locales for table_calendar and datetime manipulation
  share_plus: ^4.0.10
#  http: ^0.13.4
#  flutter_facebook_auth: ^5.0.11

The one I have commented are using the latest version, but in here:

dependency_overrides:
#  flutter_local_notifications: ^15.1.0+1
#  device_info_plus: ^9.0.2
#  package_info_plus: ^4.0.2
  intl: ^0.18.1
#  share_plus: ^7.0.2
  http: ^1.1.0
  flutter_facebook_auth: ^6.0.0

And the ones that are commented here, are those I cannot update by any way.

So after all manual updates, I'm still having package_info_plus: ^1.4.2.

Flutter doctor:

  • Android SDK at /Users/dani/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Users/dani/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9123335/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] Android Studio (version 2021.3)
    • Android Studio at /Users/dani/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9123335/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[✓] VS Code (version 1.69.2)
    • VS Code at /Users/dani/Downloads/Visual Studio Code.app/Contents
    • Flutter extension version 3.60.0

[✓] Connected device (3 available)            
    • Android SDK built for arm64 (mobile) • emulator-5554 • android-arm64  • Android 10 (API 29) (emulator)
    • macOS (desktop)                      • macos         • darwin-arm64   • macOS 13.3.1 22E772610a darwin-arm64
    • Chrome (web)                         • chrome        • web-javascript • Google Chrome 115.0.5790.114

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Flutter is also updated to latest version.

Any ideas how to fix these dependencies?


Solution

  • When this happens, normally it's because an old/deprecated/not really well maintained package conflicting with something else.

    There is no an unique or easy way to fix this. Maybe you need that particular package and you need to stick with the rest, maybe you can manually update the other packages conflicting with this old one or maybe (and this is what I did) you can find another option.

    In my case, I was using this one:

    https://pub.dev/packages/open_file_safe

    Solution was moving to this other one:

    https://pub.dev/packages/open_file_plus

    And run:

    flutter pub outdated  && flutter pub upgrade --major-versions