Flutter build error: Dart 2.13.1 is incompatible with your dependencies' SDK constraints

Flutter build error: Dart 2.13.1 is incompatible with your dependencies' SDK constraints

我是 Flutter 的新手,似乎不太了解这个问题。

这是我的 pubspec.yaml:

name: app
version: 1.0.0+1
environment:
  sdk: ">=2.16.0-80.1.beta <3.0.0"
dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.2
  flutter_login: ^3.1.0
  font_awesome_flutter: ^9.2.0
  flutter_secure_storage: ^5.0.2
  flutter_bloc: ^8.0.1
  shared_preferences: ^2.0.12
  equatable: ^2.0.3
  json_annotation: ^4.4.0
dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^1.0.0
  build_runner: ^2.1.7
flutter:
  uses-material-design: true

我当然尝试 运行 $(flutter) pub get,将 flutter 频道更新到最新的 master 和 dev,运行 $flutter packages pub 运行 build_runner 观看,但无济于事...

开发频道特别列出了“Dart 2.16.0 (build 2.16.0-134.1.beta)”作为依赖工具,但我仍然遇到相同的编译错误。

刚回到这个项目,有了新的思路,我很快通过将环境sdk更改为“>=2.15.1 <3.0.0”来解决问题。