0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

pubspec.yaml: A dependency may only have one source.

Posted at

発生したエラー

  • pubspec.yamlにカスタムフォントをセットした後にflutter runを試したところ、下記のエラーが発生した。
Error on line 32, column 5 of pubspec.yaml: A dependency may only have one source.
   ╷
32 │ ┌     sdk: flutter
33 │ │     fonts:
34 │ │     - family: NotoSansJP
35 │ │       fonts:
36 │ │         - asset: static/fonts/NotoSansJP-Regular.ttf
37 │ │
38 │ │   # The following adds the Cupertino Icons font to your application.
39 │ │   # Use with the CupertinoIcons class for iOS style icons.
40 │ │   cupertino_icons: ^1.0.8
   │ └──^
   ╵

解決策

  • flutter: の場所が違った。
誤.yaml
dependencies:
  flutter:
    sdk: flutter
    #NG

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.8
  rename_app: ^1.6.5
  change_app_package_name: ^1.5.0
正.yaml
flutter:
  #✅OK
  fonts:
  - family: NotoSansJP
    fonts:
      - asset: static/fonts/NotoSansJP-Regular.ttf

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?