Flutter packages get failed depends on flutter_test any from sdk which requires SDK version <2.0.0, version solving failed

flutterpackagessdk

I create a flutter project, and run flutter packeages get,the output as below:
[second] flutter packages get
Waiting for another flutter command to release the startup lock…
Running "flutter packages get" in second…
The current Dart SDK version is 2.0.0-dev.63.0.flutter-4c9689c1d2.

Because second depends on flutter_test any from sdk which requires SDK version <2.0.0, version solving failed.
pub get failed (1)
exit code 1

flutter doctor -v

PS D:\dartstudy\second> flutter doctor -v
[√] Flutter (Channel dev, v0.5.7, on Microsoft Windows [Version 6.1.7601], locale zh-CN)
    • Flutter version 0.5.7 at E:\flutter
    • Framework revision 66091f9696 (2 weeks ago), 2018-07-09 12:52:41 -0700
    • Engine revision 6fe748490d
    • Dart version 2.0.0-dev.63.0.flutter-4c9689c1d2

[√] Android toolchain - develop for Android devices (Android SDK 28.0.1)
    • Android SDK at f:\Android\Sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.1
    • ANDROID_HOME = f:\Android\Sdk
    • Java binary at: E:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
    • All Android licenses accepted.

[√] Android Studio (version 3.1)
    • Android Studio at E:\Program Files\Android\Android Studio
    • Flutter plugin version 26.0.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)

[√] VS Code, 64-bit edition (version 1.25.1)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 2.16.0

[!] Connected devices
    ! No devices available

! Doctor found issues in 1 category.

the IDE that I use to create a project is VS code.
I changed some versions of flutter sdk, the problems are the same as above,How to fix this problem?

Best Answer

I was having a similar issue:

Running "flutter packages get" in austin-feeds-me-flutter...
The current Dart SDK version is 2.0.0-dev.58.0.flutter-f981f09760.

Because austin_feeds_me depends on palette_generator any which requires SDK version >=2.0.0-dev.61.0 <3.0.0, version solving failed.
pub get failed (1)
Process finished with exit code 1

I fixed it with the following commands:

flutter channel dev
flutter upgrade

Fix source: https://github.com/flutter/flutter/issues/19382

Related Topic