gpt4 book ai didi

image - 在 Flutter works 中显示图像一次

转载 作者:行者123 更新时间:2023-12-04 17:32:10 25 4
gpt4 key购买 nike

我在 flutter Image.assets 中遇到问题,当我在文件中设置图像并将其设置在 Assets 中时:

` flutter :使用 Material 设计:正确 Assets :

  • 图片/facebook.png`

当我把它放在我的代码中时:

Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
"images/facebook.png"

),
Text(
'$_counter',
style: Theme.of(context).textTheme.display1,
),
],
),
),

然后运行它,效果很好但是我第二次运行代码时,它没有显示这是我得到的错误:

I/flutter ( 4784): ══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE╞════════════════════════════════════════════════════ I/flutter (4784): The following assertion was thrown while resolving an image:I/flutter ( 4784): Unable to load asset: AssetManifest.json . . .I/flutter ( 4784): #381 RenderObjectToWidgetElement.mount(package:flutter/src/widgets/binding.dart:969:5) I/flutter ( 4784):#382 RenderObjectToWidgetAdapter.attachToRenderTree. (package:flutter/src/widgets/binding.dart:915:17) I/flutter (4784): #383 BuildOwner.buildScope(package:flutter/src/widgets/framework.dart:2328:19) I/flutter (4784): #384 RenderObjectToWidgetAdapter.attachToRenderTree(package:flutter/src/widgets/binding.dart:914:13) I/flutter ( 4784):#385 WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:795:7) I/flutter ( 4784):#386 runApp (package:flutter/src/widgets/binding.dart:845:7) I/flutter ( 4784): #387 main (package:flutter_app/main.dart:4:16)I/flutter ( 4784): #388 _runMainZoned.. (dart:ui/hooks.dart:229:25) I/flutter (4784): #393 _runMainZoned.(dart:ui/hooks.dart:221:5) I/flutter ( 4784): #394
_startIsolate. (dart:isolate-patch/isolate_patch.dart:305:19) I/flutter ( 4784): #395_RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12) I/flutter ( 4784):(elided 7 frames from package dart:async) I/flutter ( 4784): Imageprovider: AssetImage(bundle: null, name: "images/facebook.png")I/flutter ( 4784): Image configuration: ImageConfiguration(bundle:PlatformAssetBundle#b5447(), devicePixelRatio: 1.5, I/flutter ( 4784):locale: en_US, textDirection: TextDirection.ltr, platform: android)I/flutter ( 4784):════════════════════════════════════════════════════════════════════════════════════════════════════

最佳答案

检查这个

assets:
- images/facebook.png

确保你有完全一样的空间

flutter:

[2 whitespaces or 1 tab]assets:
[4 whitespaces or 2 tabs]- images/facebook.png

每个空间都很重要

关于image - 在 Flutter works 中显示图像一次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58676731/

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