How to downgrade Flutter SDK (Dart 1.x)

后端 未结 6 1120
情话喂你
情话喂你 2020-12-01 08:40

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.ya

相关标签:
6条回答
  • 2020-12-01 09:15

    flutter version is no longer available: Could not find a command named "version". To choose version:

    Delete old flutter folder; Download the archive and unzip to flutter folder.

    OR

    cd "$(dirname $(which flutter))" then

    git checkout . (optional)

    git pull origin (optional)

    git checkout v1.xxxxx

    flutter doctor

    p.s. Don't forget to restart your android studio

    0 讨论(0)
  • 2020-12-01 09:19

    Don't use flutter version vX.X.X, use flutter downgrade instead.

    Warning: "flutter version" will leave the SDK in a detached HEAD state. If you are using the command to return to a previously installed SDK version consider using the "flutter downgrade" command instead.

    So, you should use

    flutter downgrade 
    

    Edit:

    If there had been no previous versions installed, the above command would fail. So, if you have a specific version of Flutter that you’d like to switch to, you can use the flutter version command:

    flutter version v1.17.0
    

    You can find list of versions here

    0 讨论(0)
  • 2020-12-01 09:21

    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 version <version> (example: flutter version v1.2.1)

    This command will use a specific version number. You can have the list of the available version numbers using flutter version 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.

    0 讨论(0)
  • 2020-12-01 09:23
    1. Download Flutter SDK release: flutter_windows_1.17.0-stable: https://flutter.dev/docs/development/tools/sdk/releases
    2. Replace the existing Flutter folder to this version
    3. Make sure that environment variables and Flutter + Dart Settings on your IDE are still tied to this folder/path
    0 讨论(0)
  • 2020-12-01 09:30

    In the Flutter install directory execute

    git checkout v0.1.9
    

    then run

    flutter doctor
    

    You can check which versions are available in the Flutter GitHub repository https://github.com/flutter/flutter

    There is an open feature request to make this easier https://github.com/flutter/flutter/issues/14230

    0 讨论(0)
  • 2020-12-01 09:41

    Run the following command to see a list of available versions.

    flutter version 
    

    Then choose a version you want to switch to by running

    flutter version v1.2.1
    

    To undo and revert back to stable

    flutter channel stable
    flutter upgrade
    
    0 讨论(0)
提交回复
热议问题