flutter 有人能帮我解决加载资产时的错误吗?[关闭]

bz4sfanl  于 2023-11-21  发布在  Flutter
关注(0)|答案(1)|浏览(205)

已关闭。此问题需要details or clarity。目前不接受回答。
**要改进此问题吗?**通过editing this post添加详细信息并阐明问题。

5天前关闭。
Improve this question
我不知道为什么我会得到这个错误,有人能帮我吗?(见附件)
main.dart

Positioned(
            left: 48,
            top: 50,
            child: Container(
              width: 334,
              height: 276,
              decoration: BoxDecoration(
                image: DecorationImage(
        image: AssetImage("pictures/Fiverr Premium Kit/Social Media Kit/Instagram/Instagram Profile Image.png"),
                  fit: BoxFit.fill,
                ),
                borderRadius: BorderRadius.circular(30),
                    ),
                  ),
                ),
              
            ],
          ),
        ),
      ],
    );
  }
}

pubspec.yaml
name: my_guitar_partner
description: A new Flutter project.
publish_to: 'none'
version: 1.0.0+1

environment:
  sdk: '>=3.1.5 <4.0.0'

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.2
  music_xml: ^1.2.2
  provider: ^6.1.1
  isar: ^3.1.0+1
  path_provider: ^2.1.1
  http: ^1.1.0
  supabase_flutter: ^1.10.25
  python_ffi: ^0.4.4
  build_runner: ^2.4.6

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^2.0.0

flutter:
  assets:
    - pictures/
  uses-material-design: true

error: 
═╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞════════════════════════════════════════════════════
The following assertion was thrown resolving an image codec:
Unable to load asset: "pictures/Fiverr Premium Kit/Social Media Kit/Instagram/Instagram Profile
Image.png".
Exception: Asset not found

When the exception was thrown, this was the stack:
#0      PlatformAssetBundle.loadBuffer (package:flutter/src/services/asset_bundle.dart:372:7)
asset_bundle.dart:372
<asynchronous suspension>
#1      AssetBundleImageProvider._loadAsync (package:flutter/src/painting/image_provider.dart:811:18)
image_provider.dart:811
<asynchronous suspension>

Image provider: AssetImage(bundle: null, name: "pictures/Fiverr Premium Kit/Social Media
  Kit/Instagram/Instagram Profile Image.png")
Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#40236(), name: "pictures/Fiverr Premium
  Kit/Social Media Kit/Instagram/Instagram Profile Image.png", scale: 1.0)
════════════════════════════════════════════════════════════════════════════════════════════════════

字符串
enter image description here我试图使用assetimage显示图像

jrcvhitl

jrcvhitl1#

在您的pubspec.yaml中,在- pictures/下面添加以下路径- pictures/Fiverr Premium Kit/Social Media Kit/Instagram/,然后执行flutter pub get并再次运行应用程序

相关问题