flutter依赖于share >=0.2.1 < 2.0.0-nullsafety.2,不支持null安全,版本解析失败

4smxwvx5  于 2023-06-24  发布在  Flutter
关注(0)|答案(1)|浏览(399)

目前Dart SDK版本为3.0.5。
由于依赖于share >=0.2.1 <2.0.0-nullsafety.2,不支持null安全,版本解析失败。
“sdk:'>=1.8.0 <2.0.0 or >=2.0.0-dev.28.0 <3.0.0'“必须为2.12.0或更高版本才能启用空安全性。有关详细信息,请参见https://dart.dev/null-safety进程结束,退出代码为1
pubspec.yaml

description: A new Flutter application.
version: 1.0.0+1

environment:
  sdk: ">=2.12.0 <3.0.0"
dependencies:
  flutter:
    sdk: flutter

  #BASE
  nb_utils: ^4.4.10
  google_fonts: ^2.1.0

  #UI
  cached_network_image: ^3.2.0
  flutter_spinkit: ^5.1.0
  package_info: ^2.0.2
  flutter_speed_dial: ^5.0.0+1

  #STATE MANAGEMENT
  mobx: ^2.0.5
  flutter_mobx: ^2.0.2

  #STORAGE & PERMISSION
  permission_handler: ^8.3.0
  flutter_downloader: ^1.7.1
  path_provider: ^2.0.8
  provider: ^6.0.1

  #CONNECTIVITY
  http: ^0.13.4
  share: ^0.4.0

  url_launcher: ^6.0.17
  store_redirect: ^2.0.0

  #Firebase
  firebase_in_app_messaging: ^0.6.0+5
  firebase_messaging: ^11.2.4
  firebase_core: ^1.10.6

  # PUSH NOTIFICATION
  onesignal_flutter: ^3.2.7

  # ADS
  google_mobile_ads: ^1.0.1

  # WEB TOOLS
  flutter_inappwebview: ^5.3.2

  flutter_localizations:
    sdk: flutter

dev_dependencies:
  flutter_test:
    sdk: flutter
  build_runner: ^2.1.7
  mobx_codegen: ^2.0.4
  #flutter packages pub run build_runner build --delete-conflicting-outputs

flutter:
  uses-material-design: true
  assets:
    - assets/
    - lang/

它给出了一个错误,所以我不能得到建设

2wnc66cl

2wnc66cl1#

根据你得到的错误,你的sdk版本没有启用null-safety功能。
如果运行的版本低于flutter 3,请尝试flutter upgrade并更新SDK

environment:
  sdk: ">=2.12.0 <3.0.0"

environment:
  sdk: '>=2.18.5 <3.0.0' or higher

相关问题