gpt4 book ai didi

flutter - 如何配置 pubspec.yaml 以添加我从 fluttericon 生成的自定义图标?

转载 作者:行者123 更新时间:2023-12-04 01:14:53 28 4
gpt4 key购买 nike

我按照此 Medium Article 中的步骤进行操作能够在我的 Flutter 应用程序中使用我的自定义图标,但我发现配置 pubspec.yaml 很棘手文件添加 .dart文件和 .ttf到依赖项,我收到以下错误:

 Error on line 45, column 4 of pubspec.yaml: A dependency specification must be a string or a mapping.

45 │ ┌ - family: RechargeExpress
46 │ │ fonts:
47 │ │ - asset: fonts/RechargeExpress.ttf
48 │ │
49 │ │ # The following line ensures that the Material Icons font is
50 │ │ # included with your application, so that you can use the icons in
51 │ │ # the material Icons class.
52 │ │ uses-material-design: true
│ └──^

pub
upgrade failed (65; ╵)
我的 pubspec.yaml :
environment:
sdk: ">=2.7.0 <3.0.0"

dependencies:
flutter:
sdk: flutter

flutter_localizations:
sdk: flutter
http:

cupertino_icons: ^0.1.3

dev_dependencies:
flutter_test:
sdk: flutter
curved_navigation_bar:

fonts:
- family: RechargeExpress
fonts:
- asset: fonts/RechargeExpress.ttf

uses-material-design: true

最佳答案

您似乎将字体添加为依赖项。检查 this看看它是否有帮助。
如果没有,请更新问题以包含您的 pubspec.yaml文件
编辑:对于字体,你把它们放在

flutter:
fonts:

编辑2:
好的,你可以看到你有 fonts:dev_dependencies:它应该在 flutter 下的位置.这是它的外观
environment:
sdk: ">=2.7.0 <3.0.0"

dependencies:
flutter:
sdk: flutter

flutter_localizations:
sdk: flutter
http:

cupertino_icons: ^0.1.3

dev_dependencies:
flutter_test:
sdk: flutter
curved_navigation_bar:

flutter:
fonts:
- family: RechargeExpress
fonts:
- asset: fonts/RechargeExpress.ttf

uses-material-design: true

关于flutter - 如何配置 pubspec.yaml 以添加我从 fluttericon 生成的自定义图标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63679927/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com