我的应用程序昨天可以运行,但今天,当我尝试运行 pub get 时出现以下错误,所以我哪里做错了,尝试添加 intl: 0.17.0-nullsafety.2 但它没有工作,提前致谢。
编辑
将 intl: 0.17.0-nullsafety 更改为 intl: ^0.16.1` ,不会改变任何内容
错误
flutter pub get
Running "flutter pub get" in koygitsin...
Because every version of date_time_picker depends on intl ^0.16.1 and temp_name depends on intl 0.17.0-nullsafety.2, date_time_picker is forbidden.
So, because temp_name depends on date_time_picker ^1.0.1, version solving failed.
pub get failed (1; So, because temp_name depends on date_time_picker ^1.0.1, version solving failed.)
exit code 1
pubspec yaml
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.0
font_awesome_flutter: ^8.10.0
carousel_slider: ^2.3.1
firebase_ml_vision: ^0.9.10
firebase_core: ^0.5.1
firebase_auth: ^0.18.3
firebase_messaging: ^7.0.3
firebase_database: ^4.3.0
firebase_storage: ^5.0.1
image_picker: ^0.6.7+12
cloud_firestore: ^0.14.3
item_selector: ^0.1.1
flutter_staggered_animations: ^0.1.2
modal_progress_hud: ^0.1.3
convex_bottom_bar: ^2.6.0
google_fonts: ^1.1.1
animations: ^1.1.2
path_provider: ^1.6.24
auto_size_text_field: ^0.1.7
intl: 0.17.0-nullsafety.2
flutter_bloc: ^6.1.1
flutter_picker: ^1.1.5
date_time_picker: ^1.0.1
sliding_up_panel: ^1.0.2
flutter_onboard: ^0.1.0
image_crop: ^0.3.4
audioplayer: ^0.8.1
flutter_countdown_timer: ^1.6.0
shared_preferences: 0.5.12+4
argon_buttons_flutter: ^1.0.6
cached_network_image: ^2.4.1
material_floating_search_bar: ^0.2.4
flutter_neumorphic: ^3.0.3
答案 0 :(得分:1)
将您的国际包版本更改为
<块引用>国际^0.16.1
在您的 pubspec.yaml 文件中
<块引用>国际:0.17.0-nullsafety.2
答案 1 :(得分:1)
发生这种情况是因为 date_time_picker 依赖于 intl ^0.16.1
1.将此添加到您的包的 pubspec.yaml
文件中:
dependency_overrides:
intl: ^0.16.1`
编辑:
或
尝试在 pubspec.yaml
文件中添加此命令:
dependency_overrides:
intl: any
2.使用 Flutter 运行:
$ flutter pub get
3.现在将它导入到您的 Dart 代码中,您可以使用:
import 'package:intl/intl.dart';