skip to Main Content

I’m working on a Flutter app and I want to install the wakelock_plus plugin: https://pub.dev/packages/wakelock_plus

Here’s the output when I run flutter pub add wakelock_plus:


The current Dart SDK version is 2.19.4.

Because flutter_html >=2.0.0-nullsafety.1 <3.0.0-alpha.1 depends on flutter_svg >=0.22.0 <1.0.0 which depends on xml ^5.0.0, flutter_html >=2.0.0-nullsafety.1 <3.0.0-alpha.1 requires xml ^5.0.0.

And because dbus >=0.7.4 depends on xml ^6.1.0, flutter_html >=2.0.0-nullsafety.1 <3.0.0-alpha.1 is incompatible with dbus >=0.7.4.

And because wakelock_plus <1.2.0 depends on dbus ^0.7.8 and wakelock_plus >=1.2.0 requires SDK version >=3.3.0 <4.0.0, flutter_html >=2.0.0-nullsafety.1 <3.0.0-alpha.1 is incompatible with wakelock_plus.

So, because APP_NAME depends on both flutter_html ^2.2.1 and wakelock_plus any, version solving failed.

pub finished with exit code 65


I’ve been trying to decipher this for a few hours and I can’t figure out if there’s a way around the dependency conflict.

Anyone have a suggestion?

2

Answers


  1. Chosen as BEST ANSWER

    FOUND A SOLUTION

    I determined that the issue was caused by the underlying flutter_svg package required by flutter_html.

    Adding the following to my pubspec.yaml eliminated the dependecy.

    dependency_overrides: 
      flutter_svg: ^1.0.0
    

    Found the solution here: https://github.com/Sub6Resources/flutter_html/issues/978


  2. Run flutter pub deps on the console to get all your dependencies version recursively printed as a treeify map:

    (here is a sample output)
    
    Dart SDK 2.19.5
    Flutter SDK 3.7.8
    YourAppName version
    ├── packageA 0.0.1
    │   ├── flutter...
    │   └── packageB 1.0.0
    ├── packageB 1.0.2
    │   └── flutter...
    ├── packageC 2.3.0
    │   ├── flutter...
    │   └── packageB 2.0.3
    ├── packageD 0.0.1
    │   ├── flutter...
    │   └── packageB 1.0.3
    └── ...
    

    Then search the name of conflict package one by one on the website https://pub.dev to confirm that if there is a newer/older version than yours. So you can try to upgrade/downgrade the version gradually on pubspec.yaml and rerun flutter pub get to check if your execution is successful (error message shows less than before).
    The worst situation is you even have to upgrade the dart version to solve the problem.

    Repeat above operations again and again until there is no error message shows (aiming to make sure that all the version condition satisfies all the conflict packages’ version requirement). The key is to keep the same package in your project and also the dependencies in use, they all must share the same version meanwhile.

    The most useful way to use a specific package version forcedly to against using the highest one by Dart is as follows (for example):

    # ./pubspec.yaml
    
    environment:
      sdk: ^2.19.0 #3.0.0
    
    dependencies:
      packageA: 0.0.1
      packageB: 1.0.2
      packageC:
        git:
          url: ssh://git@../packageC.git #packageB: 2.0.3
      packageD:
        path: ./pods/packageD/ #packageB: 1.0.3
    
    dependency_overrides:
    # Maybe the latest version is 2.0.3.
    # The packageB is required by the packageC you claimed
    # on pubspec.yaml (packageB >= 1.0.2), but there is a critical
    # bug on 2.0.3 or the code changes a lot compared with
    # previous versions that causes more time cost in adaption
    # on your project.
      packageB: 1.0.2
      
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search