Image pubspec.yaml第4列第40行出错:解析块映射时需要一个键。资产:^ 要向应用程序添加资产,请添加资产部分,如下所示:

Image pubspec.yaml第4列第40行出错:解析块映射时需要一个键。资产:^ 要向应用程序添加资产,请添加资产部分,如下所示:,image,flutter,assert,Image,Flutter,Assert,资产: -图片/contact.png #-images/a_dot_ham.jpeg包含应用程序目录中资产文件夹中的所有资产 我的pubspec文件看起来像 # The following section is specific to Flutter. flutter: # The following line ensures that the Material Icons font is # included with your application, so that you c

资产: -图片/contact.png
#-images/a_dot_ham.jpeg包含应用程序目录中资产文件夹中的所有资产

我的pubspec文件看起来像

# The following section is specific to Flutter.
flutter:

  # 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.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - assets/

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.io/assets-and-images/#resolution-aware.
像这样使用它

Image.asset('assets/logo.png')

确保正确缩进以避免错误。

包括应用程序目录中资产文件夹中的所有资产

我的pubspec文件看起来像

# The following section is specific to Flutter.
flutter:

  # 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.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - assets/

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.io/assets-and-images/#resolution-aware.
像这样使用它

Image.asset('assets/logo.png')
确保正确缩进以避免错误。

只需设置缩进即可 名称:Flatter_demo1 描述:一个新的颤振应用。 版本:1.0.0+1

环境: sdk:“>=2.1.0只需设置缩进即可 名称:Flatter_demo1 描述:一个新的颤振应用。 版本:1.0.0+1

环境: sdk:“>=2.1.0我也有同样的错误

我的问题是
使用材料设计:
资产:
未对齐

   uses-material-design: true  //column 3 

    # To add assets to your application, add an assets section, like this:
    assets://column 4
简单的解决方案是确保“我的资产”部分与“我的使用材料设计”部分保持一致,换句话说,它们应与以下代码放在同一列中:

   uses-material-design: true  //column 3

    # To add assets to your application, add an assets section, like this:
   assets://column 3
我也犯了同样的错误

我的问题是
使用材料设计:
资产:
未对齐

   uses-material-design: true  //column 3 

    # To add assets to your application, add an assets section, like this:
    assets://column 4
简单的解决方案是确保“我的资产”部分与“我的使用材料设计”部分保持一致,换句话说,它们应与以下代码放在同一列中:

   uses-material-design: true  //column 3

    # To add assets to your application, add an assets section, like this:
   assets://column 3

你能发布你正在添加
资产的部分吗?你能发布你正在添加
资产的部分吗?如果他们使用JSON,那就太好了,至少可以说YAML很烦人。如果他们使用JSON,那就太好了,至少可以说YAML很烦人。