将 flutter 项目更新为稳定的空安全

时间:2021-03-30 11:46:42

标签: flutter flutter-dependencies flutter-sdk

我正在尝试将我的 flutter 项目更新为 flutter stable 2.0.3,但出现错误:

因为来自 sdk 的 flutter_driver 的每个版本都依赖于 webdriver 2.1.2,后者依赖于存档 >=1.0.0 <3.0.0,所以来自 sdk 的每个版本的 flutter_driver 都需要存档 >=1.0.0 <3.0.0。

有大佬知道怎么解决吗?我尝试导入包 webdriver 版本 ^3.0.0,但是在尝试运行该应用程序时,出现错误:

因为sdk中flutter_driver的每个版本都依赖于webdriver 2.1.2,而app依赖于webdriver ^3.0.0,所以sdk中的flutter_driver是被禁止的。因此,由于应用程序依赖于 sdk 中的任何 flutter_driver,因此版本解析失败。在应用程序中运行“flutter pub get”... pub get failed (1; 所以,因为 app 依赖于 sdk 中的任何 flutter_driver,版本解析失败。)

这是我的 pubscpec:

environment:
  sdk: ">=2.5.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  auto_size_text: ^2.1.0 #https://pub.dev/packages/auto_size_text
  auto_orientation: ^1.0.5 #https://pub.dev/packages/auto_orientation
  cached_network_image: ^2.0.0 #https://pub.dartlang.org/packages/cached_network_image#-installing-tab-
  carousel_slider: ^1.3.0 #https://github.com/serenader2014/flutter_carousel_slider
  connectivity: ^3.0.3 #https://pub.dev/packages/connectivity
  cpf_cnpj_validator: ^1.0.5 #https://github.com/leonardocaldas/flutter-cpf-cnpj-validator
  dots_indicator: ^1.0.0 #https://pub.dev/packages/dots_indicator
  image_picker: ^0.6.0+15 #https://pub.dartlang.org/packages/image_picker
  flutter_cache_manager: ^3.0.1 #https://pub.dev/packages/flutter_cache_manager
  flutter_full_pdf_viewer: ^1.0.6 #https://pub.dev/packages/flutter_full_pdf_viewer
  flutter_local_notifications: ^5.0.0 #https://pub.dev/packages/flutter_local_notifications
  flutter_masked_text: ^0.8.0 #https://pub.dartlang.org/packages/flutter_masked_text
  flutter_slidable: ^0.5.4 #https://pub.dev/packages/flutter_slidable
  flutter_svg: ^0.18.0 #https://pub.dartlang.org/packages/flutter_svg#-installing-tab-
  flushbar: ^1.10.2 #https://pub.dev/packages/flushbar
  google_maps_flutter: ^0.5.20+6 #https://pub.dev/packages/google_maps_flutter
  http: ^0.13.0 #https://pub.dev/packages/http
  package_info: ^0.4.0+6 #https://pub.dev/packages/package_info
  path_provider: ^2.0.1 #https://pub.dev/packages/path_provider
  photo_view: ^0.4.0 #https://pub.dartlang.org/packages/photo_view#-installing-tab-
  provider: ^4.0.1 #https://pub.dev/packages/provider
  rate_my_app: ^0.7.2 #https://pub.dev/packages/rate_my_app
  rxdart: ^0.26.0 #https://pub.dartlang.org/packages/rxdart
  sendgrid_mailer: ^0.1.2 #https://pub.dev/packages/sendgrid_mailer
  share_extend: ^1.0.9 #https://pub.dev/packages/share_extend
  store_redirect: ^1.0.2 #https://pub.dev/packages/store_redirect
  url_launcher: ^5.2.5 #https://pub.dev/packages/url_launcher
  webdriver: ^3.0.0

  # Firebase packages
  cloud_firestore: ^1.0.1
  firebase_core: ^1.0.1
  firebase_auth: ^1.0.1
  firebase_analytics: ^7.1.1
  cloud_functions: ^1.0.0
  firebase_storage: ^8.0.0
  firebase_crashlytics: ^1.0.0 #https://pub.dev/packages/firebase_crashlytics
  firebase_messaging: ^9.0.0 #https://pub.dev/packages/firebase_messaging

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2

dev_dependencies:
  test: ^1.5.1
  flutter_driver:
    sdk: flutter
  flutter_test:
    sdk: flutter
  pedantic: null

1 个答案:

答案 0 :(得分:0)

我找到了一个解决方案,为了解决这个问题,我必须覆盖依赖关系,如下所示:

dependency_overrides:
  archive: ^3.1.2
  crypto: ^3.0.0
  xml: ^5.0.2