运行flutter pub add flutter_icons时出现奇怪错误

mqkwyuun  于 2023-08-07  发布在  Flutter
关注(0)|答案(1)|浏览(190)

我希望我错过了一些琐碎的事情。当我运行flutter pub add flutter_icons时,我得到错误:

The current Dart SDK version is 3.0.6.

Because <app_name> depends on flutter_icons any which doesn't support null safety, version solving failed.

The lower bound of "sdk: '>=2.0.0-dev.68.0 <3.0.0'" must be 2.12.0 or higher to enable null safety.
For details, see https://dart.dev/null-safety

字符串
我阅读这篇文章的意思是我需要的dart版本高于2.12.0,我有dart版本3.0.6。

dart --version
Dart SDK version: 3.0.6 (stable) (Tue Jul 11 18:49:07 2023 +0000) on "macos_arm64"


pubspec.yaml很简单:

name: <app_name>
description: A new Flutter project.

publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 0.0.1+1

environment:
  sdk: '>=2.19.4 <4.0.0'

dependencies:
  flutter:
    sdk: flutter

  english_words: ^4.0.0
  provider: ^6.0.0

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_lints: ^2.0.0

flutter:
uses-material-design: true


我希望它构建没有错误,因为我有一个空安全版本的dart。我是新手,所以可能错过了一些明显的东西。谢谢你的帮忙。

euoag5mw

euoag5mw1#

hi flutter_icons包对于dart 3是不可计算的,它没有null safety,而你的Flutter需要null safety。要么你可以降级你的Flutter或尝试找到一些其他的软件包。我建议搜索其他包。
为什么你需要这个包?

编辑二:

尝试此软件包flutter_font_icons它已更新

flutter pub add flutter_font_icons

字符串

相关问题