Error: The lower bound of "sdk: '>=2.7.0 <3.0.0'" must be 2.12.0' or higher to enable null safety

huangapple go评论132阅读模式
英文:

Error: The lower bound of "sdk: '>=2.7.0 <3.0.0'" must be 2.12.0' or higher to enable null safety

问题

请帮忙。
当尝试运行应用程序时,我收到了标题中的错误。
我的 Dart 版本是 3.0.3,以下是 pubspec.yaml 文件的内容:

version: 1.15.1+1

environment:
  sdk: ">=2.12.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_bloc: ^7.3.1
  equatable:

  # Http
  dio: ^4.0.0
  pretty_dio_logger: ^1.1.1
  jwt_decoder: ^2.0.0

  # Database
  floor: ^1.4.1
  uuid: ^3.0.2
  localstorage: ^4.0.0+1

  # UI
  avatar_glow: ^2.0.1
  flutter_launcher_icons: ^0.9.0
  image_picker: ^0.8.0
  transparent_image: ^2.0.0
  flutter_svg: ^0.22.0
  lottie: ^1.1.0
  fluttertoast: ^8.0.9

  # Logger
  logger: ^0.7.0+2
  logger_flutter: ^0.7.1

  get: ^4.6.5
  permission_handler: ^8.0.0+2
  audioplayers: ^0.20.0
  rxdart: ^0.26.0
  ota_update: ^4.0.2
  package_info_plus: ^1.4.3
  cached_network_image: ^3.2.3

dev_dependencies:
  flutter_test:
    sdk: flutter
  bloc_test: ^8.0.0
  mockito: ^5.3.2
  floor_generator: ^1.2.0
  build_runner: ^2.1.11

flutter_icons:
  android: true
  ios: true
  image_path: "assets/png/icon_dit_jade.png"

flutter:
  uses-material-design: true
  assets:
    - assets/
    - assets/animated/
    - assets/png/
  fonts:
    - family: OpenSans
      fonts:
        - asset: assets/fonts/OpenSans-Light.ttf
        - asset: assets/fonts/OpenSans-SemiBold.ttf
          weight: 600
    - family: Ubuntu
      fonts:
        - asset: assets/fonts/Ubuntu-Regular.ttf
          style: normal
        - asset: assets/fonts/Ubuntu-Italic.ttf
          style: italic

我尝试使用以下命令进行迁移:dart pub outdated --node=null-safetydart pub update --node=null-safety,但我收到以下错误:

ERROR: "Because jadbot depends on logger_flutter >=0.7.0 which doesn't support null safety, version solving failed."

当尝试降级到 Dart 版本 2.19.0 时,我得到了附加截图的结果 Error: The lower bound of "sdk: '>=2.7.0 <3.0.0'" must be 2.12.0' or higher to enable null safety

我使用了 dart fix --dry-rundart fix --apply,然后尝试运行应用程序,但出现了这个错误:Error: The lower bound of "sdk: '>=2.7.0 <3.0.0'" must be 2.12.0' or higher to enable null safety

英文:

Help please.
I get the error in the title when trying to run the app.
My dart version is 3.0.3 and here is the content of the pubspec.yaml file:


version: 1.15.1+1
environment:
sdk: &quot;&gt;=2.12.0&quot;
dependencies:
flutter:
sdk: flutter
flutter_bloc: ^7.3.1
equatable:
# Http
dio: ^4.0.0
pretty_dio_logger: ^1.1.1
jwt_decoder: ^2.0.0
# Database
floor: ^1.4.1
uuid: ^3.0.2
localstorage: ^4.0.0+1
# UI
avatar_glow: ^2.0.1
flutter_launcher_icons: ^0.9.0
image_picker: ^0.8.0
transparent_image: ^2.0.0
flutter_svg: ^0.22.0
lottie: ^1.1.0
fluttertoast: ^8.0.9
# Logger
logger: ^0.7.0+2
logger_flutter: ^0.7.1
get: ^4.6.5
permission_handler: ^8.0.0+2
audioplayers: ^0.20.0
rxdart: ^0.26.0
ota_update: ^4.0.2
package_info_plus: ^1.4.3
cached_network_image: ^3.2.3
dev_dependencies:
flutter_test:
sdk: flutter
bloc_test: ^8.0.0
mockito: ^5.3.2
floor_generator: ^1.2.0
build_runner: ^2.1.11
flutter_icons:
android: true
ios: true
image_path: &quot;assets/png/icon_dit_jade.png&quot;
flutter:
uses-material-design: true
assets:
- assets/
- assets/animated/
- assets/png/
fonts:
- family: OpenSans
fonts:
- asset: assets/fonts/OpenSans-Light.ttf
- asset: assets/fonts/OpenSans-SemiBold.ttf
weight: 600
- family: Ubuntu
fonts:
- asset: assets/fonts/Ubuntu-Regular.ttf
style: normal
- asset: assets/fonts/Ubuntu-Italic.ttf
style: italic

I tried migrating using the commands: dart pub outdated --node=null-safety and dart pub update --node=null-safety but I get the error
ERROR: "Because jadbot depends on logger_flutter >=0.7.0 which doesn't support null safety, version solving failed."

when trying to downgrade to dart version 2.19.0 I get the result of the attached screenshot Error: The lower bound of "sdk: '>=2.7.0 <3.0.0'" must be 2.12.0' or higher to enable null safety

used dart fix --dry-run and dart fix --apply and tried running the app after but got this error: Error: The lower bound of "sdk: '>=2.7.0 <3.0.0'" must be 2.12.0' or higher to enable null safety

答案1

得分: 0

[更新]: 降低 Dart 版本对我有用。有相同问题的人应该尝试匹配版本,因为这似乎是问题所在。

英文:

[Update]: Downgrading the version of dart worked for me. Anyone who has the same issue should try matching versions, as it seemed to be the probem.

huangapple
  • 本文由 发表于 2023年7月13日 21:49:06
  • 转载请务必保留本文链接:https://go.coder-hub.com/76680137.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定