【发布时间】:2019-02-15 21:23:48
【问题描述】:
我正在使用 flutter_svg(版本 0.10.3)包在我的应用程序中加载 svg。但它向我显示一个错误,说它无法加载资源。 这是我的代码
static final Map<Gender, String> _genderImage = {
Gender.female: 'assets/images/gender_female.svg',
Gender.other: 'assets/images/gender_other.svg',
Gender.male: 'assets/images/gender_male.svg'
};
Widget icon = Padding(
padding: EdgeInsets.only(left: _leftPadding(context)),
child: SvgPicture.asset(
_assetName,
height: _iconSize(context),
width: _iconSize(context),
));
这是错误: 抛出了另一个异常:无法加载资产:assets/images/gender_male.svg
【问题讨论】:
-
您是否已将它们添加到
pubspec.yaml? -
否,但我认为我正在使用的软件包没有必要
-
很确定是:-)
-
是的,你是对的。谢谢