我目前正尝试在Flutter应用程序中实现本地化,但每当我尝试为flutter_localization
添加依赖项时,我都会收到以下错误消息:
由于计时器依赖于SDK中不存在的flutter_localization
(无法在Flutter SDK中找到包flutter_localization
),版本求解失败。
我还在Android Studio中正确地添加了flutter和dart SDK的路径。
下面是我的pubspec.yaml
文件:
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: '>=2.18.2 <3.0.0'
dependencies:
flutter:
sdk: flutter
intl: ^0.17.0-nullsafety.2
cupertino_icons: ^1.0.2
sqflite: any
shared_preferences: ^2.0.15
path_provider: any
flutter_localization:
sdk: flutter
flutter_cupertino_localizations: ^1.0.1
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
flutter:
uses-material-design: true
没有flutter_localization,我无法访问GlobalMaterialLocalizations,显然,这是最简单的解决方案。我已经尝试了许多解决方案,如检查版本兼容性和更新所有依赖项。你们能帮我吗?
提前致谢!
升级SDK、升级依赖项、重新安装flutter和Dart等
2条答案
按热度按时间5kgi1eie1#
您拼错了软件包
替换
与
记录flutter_localization上的s
smtd7mpg2#
将其添加到您的
pubspec.yaml
中,并按照本文中的说明using gen-l10 n部分进行操作https://localizely.com/blog/flutter-localization-step-by-step/?tab=using-gen-l10n