Home > Net >  SDK in pubspec.yaml not same as in flutter --version
SDK in pubspec.yaml not same as in flutter --version

Time:05-23

I'm trying to set environment sdk version to a higher number but it says that my current SDK is as seen below:

The current Dart SDK version is 2.14.4.

Because demo_app_1 requires SDK version >=2.16.0 <3.0.0, version solving failed.
pub get failed (1; Because demo_app_1 requires SDK version >=2.16.0 <3.0.0, version solving failed.)
exit code 1

When i run flutter --version i get the following:

Flutter 3.1.0-0.0.pre.854 • channel master • https://github.com/flutter/flutter.git
Framework • revision ec20ea80ad (17 hours ago) • 2022-05-21 16:28:06 -0400
Engine • revision 1bfe551d6b
Tools • Dart 2.18.0 (build 2.18.0-142.0.dev) • DevTools 2.13.1

Any help would be much appreciated. Thanks.

CodePudding user response:

The problem is that demo_app_1 requires an SDK version >= (higher or equal) 2.16.0 but < (below) 3.0.0. The version you have installed is 3.1.0, which does not fulfill the requirement.

You have two options:

  1. Change your flutter installation version
    • flutter downgrade <version>
    • flutter doctor
  2. Change the required SDK version in your pubspec.yaml
    • Change the environment->sdk value
    • flutter pub get

After that, the issue should be resolved.

CodePudding user response:

Run flutter downgrade 3.0.0 and check if solved

  • Related