如何降级 Flutter SDK (Dart 1.x) [英] How to downgrade Flutter SDK (Dart 1.x)

查看:66
本文介绍了如何降级 Flutter SDK (Dart 1.x)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我升级了 Flutter SDK,现在我的项目坏了.我需要基本上恢复到使用 Dart 1.x 的 Flutter SDK.

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.

我在 pubspec.yaml 中尝试了以下内容,

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)

我需要卸载 SDK 并重新安装吗?

Do i need to uninstall the SDK and reinstall it?

推荐答案

Flutter 使用 git 进行版本控制.更改 Flutter 版本就像更改 git branch 一样简单.

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

有两种不同的方式:

  • flutter channel (示例:flutter channel stable)

这个命令用于在分支之间切换——通常是stable/dev/beta/master.我们也可以从 git 中输入一个特定的提交 ID.

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 (示例:flutter downgrade v1.2.1)

此命令将使用特定的版本号.您可以使用 flutter downgrade此处

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

在此之后,运行任何 Flutter 命令(例如 flutter doctor),Flutter 将负责下载/编译运行此版本所需的一切.

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

这篇关于如何降级 Flutter SDK (Dart 1.x)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆