为什么Flutter_SVG软件包在软件包中不起作用?
我的问题是,我正在编写一个软件包,其中包含一些有用的小部件。我要做的成功就是,创建一个使用我的软件包资产的小部件,并将其显示为任何应用程序。
所以;
依赖性: 扑: SDK:颤抖 flutter_svg: ^1.0.3
扑来: 资产:
- 资产/插图/
我正确地将SVG资产添加到我的包装中,然后在小部件上称其为;
SvgPicture.asset(
"assets/illustrations/xx.svg",
width: 50,
height: 220.0,
)
如果我们假设我的窗口小部件名称xx,
我正在使用我的应用中的xx小部件,例如xx();
我遇到了这些错误;
The following assertion was thrown resolving a single-frame picture stream:
无法加载资产:资产/插图/.... SVG
When the exception was thrown, this was the stack:
#0 PlatformAssetBundle.load(软件包:Flutter/src/services/asset_bundle.dart:237:7)
#1 AssetBundle.LoadString(软件包:flutter/src/services/asset_bundle.dart:72:27)
#2 AssetBundlePictureProvider.__loadAsync(软件包:Flutter_svg/src/picture_provider.dart:546:25)
但是,如果我执行相同的步骤来添加资产并以相同的方式在我的真实应用程序上使用相同的.svg文件,则它可以正常工作。
所以这是我的问题;使用软件包中的SVG资产有什么区别,并将其从真实的应用程序项目中调用。
最后,我为我的英语差而感到抱歉,但任何想法都会被乐于接受,谢谢你:)
My problem is, I am writing a package and it is contains some helpful widgets. And what I do succeed is simply, create a widget with uses my package assets and show it to any app.
So;
dependencies:
flutter:
sdk: flutter
flutter_svg: ^1.0.3
flutter:
assets:
- assets/illustrations/
I add correctly the svg assets to my package, and I call it on my widget like;
SvgPicture.asset(
"assets/illustrations/xx.svg",
width: 50,
height: 220.0,
)
if we assume my widget name XX
I am using the XX widget in my app like XX();
and I am getting these errors;
The following assertion was thrown resolving a single-frame picture stream:
Unable to load asset: assets/illustrations/....svg
When the exception was thrown, this was the stack:
#0 PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:237:7)
#1 AssetBundle.loadString (package:flutter/src/services/asset_bundle.dart:72:27)
#2 AssetBundlePictureProvider._loadAsync (package:flutter_svg/src/picture_provider.dart:546:25)
But if I do same steps for adding assets and using same way the same .svg file on my real app, it is working correctly.
So here is my question; What is the difference using a svg asset in a package and call it from the real app project.
and lastly, I am sorry for my poor english but any idea will be gladly accepted, thank u :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在中找到了解决方案,从这里,我们需要的简单就是给出包:“”,参数。
I found the solution at from here and what we need is simply, give the package: "", parameter.