【问题标题】:This requires the 'super-parameters' language feature to be enabled这需要启用“超级参数”语言功能
【发布时间】:2022-08-19 22:20:22
【问题描述】:

我在 initState 方法中使用 super 关键字。但我收到此错误 \'这需要启用 \'super-parameters\' 语言功能。 尝试更新您的 pubspec.yaml 以将最低 SDK 约束设置为 2.16.0 或更高版本,然后运行 ​​\'pub get\'.dart(experiment_not_enabled)\'。需要帮助。

  • 你能包括你的 code-sn-p 吗?
  • 请提供足够的代码,以便其他人可以更好地理解或重现该问题。
  • 每当我尝试使用super.param 时,我都会收到此消息,就像我在构造函数中使用this.param 一样。这是 Dart 中一个相对较新的功能。

标签: flutter


【解决方案1】:

super-parameters 被添加到 Dart 2.17.0 中。

如果您尚未使用最新版本,请运行

flutter upgrade

要在您的应用程序中使用super-parameters,请打开您的pubspec.yaml 文件并将sdk 更新为目标最小2.17.0

environment:
  sdk: ">=2.17.0 <3.0.0"

【讨论】:

  • 最后别忘了运行flutter pub get
【解决方案2】:

试试flutter pub cache cleanflutter pub get

【讨论】:

    猜你喜欢
    • 2022-07-25
    • 2021-09-11
    • 1970-01-01
    • 2020-11-18
    • 2010-10-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-28
    相关资源
    最近更新 更多