Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
258 views
in Technique[技术] by (71.8m points)

How to downgrade Flutter SDK (Dart 1.x)

I upgraded my Flutter SDK and now my project is broken. I need to basically revert back to a Flutter SDK which uses Dart 1.x.

I tried the following in the pubspec.yaml,

environment:
  sdk: ">=1.19.0 <2.0.0"
  flutter: "^0.1.2"

dependencies:
  flutter:
    sdk: flutter

but now the project just simply doesn't build.

Running "flutter packages get" in binformed...
Package binformed requires Flutter SDK version ^0.1.2 but the current SDK is 0.2.5-pre.38.
pub get failed (1)

Do i need to uninstall the SDK and reinstall it?

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Flutter is versioned using git. Changing the Flutter version is as simple as changing git branch.

There are 2 different ways:

  • flutter channel <branch> (example: flutter channel stable)

This command is used to change between branches – usually stable/dev/beta/master. We can also put a specific commit id from git.

  • flutter downgrade <version> (example: flutter downgrade v1.2.1)

This command will use a specific version number. You can have the list of the available version numbers using flutter downgrade or here

After this, run any Flutter command (such as flutter doctor), and Flutter will take care of downloading/compiling everything required to run this version.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...