飞镖2.17.0:我如何启用“增强型”?

发布于 2025-01-28 19:29:16 字数 262 浏览 2 评论 0原文

代码示例:

enum ShareType {
NONE('N'),
PUBLISH('P'),
  SHARE('S');

final String key;
const ShareType(String keyToSet) {this.key = keyToSet;}
}

给出错误:

这需要启用“增强 - 启动”语言功能。

如何启用此功能? 必须设置在哪里?

Code example:

enum ShareType {
NONE('N'),
PUBLISH('P'),
  SHARE('S');

final String key;
const ShareType(String keyToSet) {this.key = keyToSet;}
}

gives error:

This requires the 'enhanced-enums' language feature to be enabled.

How do I enable this feature?
Where must this be set?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

妞丶爷亲个 2025-02-04 19:29:16

进入项目中的pubspec.yaml文件,并确保sdk的最低版本是2.17.0类似

environment:
  sdk: ">=2.17.0 <3.0.0"

:这就是DART跟踪何时引入功能,并确保您的项目不利用不兼容的功能,而这些功能对于您的项目根据需要指定的版本范围不兼容。

Go into your pubspec.yaml file in your project and make sure that the minimum version for the sdk are 2.17.0 like:

environment:
  sdk: ">=2.17.0 <3.0.0"

The reason for this is that Dart keeps track of when features are introduced and makes sure your project does not make use of features that would not be compatible for the range of versions your project have specified as required.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文