这是我的小部件,在应用程序中显示自己的一张小照片。
Widget image() {
return CircleAvatar(
radius: 50.0,
backgroundImage: AssetImage('images/me.jpeg'),
);
}
然而,出于某种原因,我一直在得到这个
The following assertion was thrown resolving an image codec:
Unable to load asset: images/me.jpeg
When the exception was thrown, this was the stack:
#0 PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:225:7)
<asynchronous suspension>
#1 AssetBundleImageProvider._loadAsync (package:flutter/src/painting/image_provider.dart:668:31)
#2 AssetBundleImageProvider.load (package:flutter/src/painting/image_provider.dart:651:14)
#3 ImageProvider.resolveStreamForKey.<anonymous closure> (package:flutter/src/painting/image_provider.dart:504:13)
...
Image provider: AssetImage(bundle: null, name: "images/me.jpeg")
Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#14309(), name: "images/me.jpeg", scale: 1.0)
尽管图像在文件夹中。请帮忙
确保您将图像添加到pubspec.yaml文件中,然后运行pub get
assets:
- images/me.jpeg
显然,没有一个Flutter命令在Android Studio的终端上工作,我相信我试图在我的项目的根上运行它。 产出:
我对flutter非常陌生,我正在做一个有趣的应用程序。我想添加一个背景图像到我的应用程序,但我找不到如何。我知道我必须把它放在中,但我找不到怎么放。这是我的代码:
Xcode的输出:在文件中包含从 /Users/dani/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.0.3/ios/Classes/FLTURLLauncherPlugin.m: 7: /Users/dani/development/flutter/.pub-cache/hosted/pub.dart
我从颤振开始。在android studio中安装flutter和dart插件并下载flutter SDK后,flutter doctor无法识别android studio。我在CMD中使用了。现在颤医生认出了Android,但错误是这样的
我一直试图设置一个颤振路径,所以我不需要每次都做一个临时路径。我是新的使用终端和Unix(Mac用户也),不明白如何设置我的路径与说明在网站上。我不完全确定我的flutter SDK在哪里,这也没有帮助。想一步一步地知道该怎么做。
试图在flutter中加载图像,但无法做到这一点,得到以下错误 I/Flutter(3214):IMAGE RESOURCE SERVICE捕获的异常(3214):引发以下断言解析图像编解码器:I/Flutter(3214):无法加载资产:资产/test.jpg I/Flutter(3214):I/Flutter(3214):引发异常时,这是堆栈:I/Flutter(3214):#0 Platfo