skip to Main Content

I’m facing the below error when I try to either run flutter pub get command for dependency installation or running the entire project.

flutter pub get
Resolving dependencies... (3.2s)
The current Dart SDK version is 3.4.3.

Because logger 0.9.4 doesn't support null safety and no versions of logger match >0.9.4 <0.10.0, logger ^0.9.4 is forbidden.
So, because farmassist depends on logger ^0.9.4, version solving failed.

The lower bound of "sdk: '>=2.2.0 <3.0.0'" must be 2.12.0 or higher to enable null safety.

I tried the following methods to resolve the issue but still it didn’t help

  1. Upgrading the logger package to the latest version
  2. Trying removing logger dependency from the code and see if it could work

2

Answers


  1. try this:

    1- remove the pubspec.lock file from the root of your project

    2- remove logger package from the pubspec.yaml file

    3- run this flutter pub add logger command in your terminal

    4- run the flutter pub get command in your terminal

    let me know if it helped

    Login or Signup to reply.
  2. Potential Reason

    It happens because of following 2 reasons:

    1. Any of the dependent library is outdated.

      Flutter/Dart is relatively new, so is in rapid development, breaking compability with some of the existing libraries. Thus, there is no choice except to replace that library.

    2. The constraints don’t satisfy the given configuration. In this case, following solution might help you out.

    Generic Solution

    The generic solution to most of the configuration problem is to start fresh

    1. Start fresh, create a brand-new flutter project with the same name, in different folder/directory.

      Note:

      It is recommended to be in latest version of flutter

      Run flutter upgrade to upgrade to latest channel.

      Run flutter channel stable to switch (if any?) to stable channel.

    2. Copy the lib folder from the old one, and replace it in the new project.

    3. Install dependency manually like this,

      $ flutter pub add xyz1
      $ flutter pub add xyz2
      
    4. This will (hopefully!) re-configure your project and will run smoothly onwards.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search