简体   繁体   中英

Update Dart SDK from 2.10.3 to 2.12.0 in Vscode

I am getting the following error when I try to update the environment sdk in flutter.

The current Dart SDK version is 2.10.3.

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

flutter doctor -v gives me the following result

[✓] Flutter (Channel beta, 2.2.0, on Mac OS X 10.15.7 19H2 darwin-x64, locale en-IN)
    • Flutter version 2.2.0 at /Users/mustafazaki/flutter
    • Framework revision b22742018b (4 weeks ago), 2021-05-14 19:12:57 -0700
    • Engine revision a9d88a4d18
    • Dart version 2.13.0

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/mustafazaki/Library/Android/sdk
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.1, Build version 12A7403
    • CocoaPods version 1.10.0

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

[✓] Android Studio (version 4.1)
    • 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 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.56.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.23.0

[✓] Connected device (3 available)
    
    • iPhone 12 Pro Max (mobile) • 67F57BF6-B6BC-4061-9BFD-01D38275C4E1 • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-14-1 (simulator)
    • Chrome (web)               • chrome                               • web-javascript • Google Chrome
      91.0.4472.77

• No issues found!

Also, why I can't see the latest dart update on vscode? It shows me only 2.10.3

在此处输入图像描述

flutter clean also doesn't seem to work.

You might just need to modify the target Dart environment of the Flutter app in its pubspec.yaml file. Update the environment section to:

environment:
  sdk: ">=2.10.0 <3.0.0"

It was mentioned in the Dart SDK changelog back in 2021. Also, if flutter upgrade doesn't work. Try adding --force in the command.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM