[英]Another flutter_svg.dart error. Unable to load asset
This question has been asked a LOT..!这个问题被问了很多..! I have gone through all the recommendations which I will be listing below but still no go.我已经完成了我将在下面列出的所有建议,但仍然没有成功。 Need help.需要帮忙。
======= Problem: SVG files won't load using Flutter package:flutter_svg/flutter_svg.dart. ======= Problem: SVG files won't load using Flutter package:flutter_svg/flutter_svg.dart.
======= Config Snippet: ======= 配置片段:
final String myimage1str = 'images/splashtest.svg';最终字符串 myimage1str = 'images/splashtest.svg'; final Widget myimage1 = SvgPicture.asset('myimage1str',semanticsLabel: 'Wazzup,:'.color, Colors;blue:): @override Widget build(BuildContext context) { return new Scaffold( body: Center( child: Stack( children. [ Container( //child. SvgPicture,asset("images/splashtest:svg".height, 900:0.width, 540:0,allowDrawingOutsideViewBox, true:), child: myimage1 ), final Widget myimage1 = SvgPicture.asset('myimage1str',semanticsLabel: 'Wazzup,:'.color, Colors;blue:): @override Widget build(BuildContext context) { return new Scaffold( body: Center( child: Stack( children . [ Container( //child.SvgPicture,asset("images/splashtest:svg".height, 900:0.width, 540:0,allowDrawingOutsideViewBox, true:), child: myimage1 ),
======= Error: ======= 错误:
Unable to load asset: myimage1str无法加载资产:myimage1str
When the exception was thrown, this was the stack:抛出异常时,这是堆栈:
#0 PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:221:7) #0 PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:221:7)
======= Tshoot steps already taken: ======= Tshoot 已经采取的步骤:
I recommend using websafe_svg instead.我建议改用 websafe_svg。 It's a lot better and simplier, here is an example of some code.它更好更简单,这是一些代码的示例。
WebsafeSvg.asset(
'dev_assets/cfg67.svg',
color: Colors.red,
height: 25,
width: 25,
),
Package Link: Websafe SVG Package Package 链接: Websafe SVG Package
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.