gpt4 book ai didi

dart - 为 flutter 更新 dart sdk

转载 作者:IT老高 更新时间:2023-10-28 12:37:55 41 4
gpt4 key购买 nike

我想在 flutter 中使用 dart SDK >= 2.2.0。但我目前使用的 Flutter 版本是 2.1.2

flutter --version
Flutter 1.2.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8661d8aecd (2 months ago) • 2019-02-14 19:19:53 -0800
Engine • revision 3757390fa4
Tools • Dart 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

我尝试独立安装2.2.0版本,我成功了:

dart --version
Dart VM version: 2.2.0 (Tue Feb 26 15:04:32 2019 +0100) on "macos_x64"

但是,正如您在上面看到的,Flutter 不使用此版本。我试图用我独立安装的版本替换flutter使用的dart-sdk文件(flutter/bin/cache/dart-sdk),但是当我尝试之后运行 Flutter,我遇到了快照问题,所以我将原来的 dart-sdk 文件夹放回了 flutter 目录中。

您有什么想法可以更新吗?

PS:我最近(10 天前)从这里下载了 Flutter:https://flutter.dev/docs/get-started/install/macos

最佳答案

这可能是因为您使用的是 channel stable,这是要更新的四个 channel 中最安全的版本( channel 已列出 here)

如果您更想尝试新功能而不必冒险构建不良版本,我建议 channel beta:

Every month, we pick the "best" dev build of the previous month or so, and promote it to beta. These builds have been tested with our codelabs.

其中stable channel 有这样的描述:

When we believe we have a particularly good build, we promote it to the stable channel. We intend to do this more or less every quarter, but this may vary. We recommend that you use this channel for all production app releases. We may ship hotfixes to the stable channel for high-priority bugs, although our intent is to do this rarely.

您可以通过在终端中运行以下命令将 channel 更改为指向 beta:flutter channel beta 后跟 flutter upgrade 以确保您获得了此特定分支的最新版本。

让我知道这对您的情况有何影响。

关于dart - 为 flutter 更新 dart sdk,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55898181/

41 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com