我最近将 Flutter 版本从我之前的版本更新到了 2.0,但除了少数例外,我决定降级回我在稳定频道上的 Flutter 版本(1.22.6)。
现在我在 pub get 上收到这个错误 因为来自 sdk 的 flutter_test 的每个版本都依赖于路径 1.8.0-nullsafety.1 而 PawFect 依赖于路径 ^1.8.0,所以禁止来自 sdk 的 flutter_test。 因此,由于 PawFect 依赖于 sdk 中的 flutter_test any,因此版本求解失败。 pub get failed (1; 所以,因为 PawFect 依赖于 sdk 中的任何 flutter_test,版本解析失败。)
我的 pubspec.yaml 现在看起来像这样。
...
version: 1.0.25+7
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
#Firebase Core API
firebase_core: ^0.7.0
#firebase analytics
firebase_analytics: ^7.0.1
#firebase crashlytics
firebase_crashlytics: ^0.4.0+1
#firebase performance
firebase_performance: ^0.5.0+1
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3
shared_preferences: ^0.5.12+4
shimmer: ^1.1.2
lite_rolling_switch: ^0.1.1
intl: ^0.17.0
# country_code_picker: ^1.7.0
image_picker: ^0.6.7+21
connectivity: ^3.0.3
# flutter_spinkit: ^4.1.2+1
# gallery_saver: ^2.0.1
# camera: ^0.5.8+5
path: ^1.8.0
http: ^0.12.2
toggle_switch: ^0.1.8
pie_chart: ^5.0.0
fl_chart: ^0.20.1
percent_indicator: ^2.1.9
simple_animations: ^2.4.2
package_info: ^0.4.3+2
# dio: ^3.0.10
sqflite: ^2.0.0+3
path_provider: ^1.6.27
get_it: ^6.0.0
progress_dialog: ^1.2.4
mime: ^0.9.7
http_parser: ^3.1.4
flutter_image_compress: ^0.7.0
flutter_launcher_icons: ^0.9.0
device_preview: ^0.7.1
fluttertoast: ^7.1.6
in_app_purchase: ^0.3.5+1
font_awesome_flutter: ^9.0.0
# rename: ^1.3.0
expansion_tile_card: ^2.0.0
url_launcher: ^6.0.2
provider: ^4.3.2+4
# number_display: ^2.3.0
# functional_widget_annotation: ^0.8.0
# stripe_payment: ^1.0.9
flutter_icons:
# android: "launcher_icon"
image_path: "assets/images/pawfect_logo.png"
# image_path_android: "assets/images/logo_large.png"
# image_path_ios: "assets/images/logo_large.png"
android: true # can specify file name here e.g. "ic_launcher"
ios: true # can specify file name here e.g. "My-Launcher-Icon"
# adaptive_icon_background: "assets/images/christmas-background.png" # only available for Android 8.0 devices and above
# adaptive_icon_foreground: "assets/images/icon-foreground-432x432.png" # only available for Android 8.0 devices and above
dev_dependencies:
flutter_test:
sdk: flutter
..
如何解决此错误,并顺利获得依赖项。?
颤动医生
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.22.6, on Mac OS X 10.15.7 19H114 darwin-x64,
locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 12.4)
[!] Android Studio (version 4.1)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[!] Connected device
! No devices available