在导入本地图片过程中发现报错,去搜索了解决方法:对齐代码格式。
第一次仅调整了此处空格,但还是报错。
“assets:”也需要对齐,如图所示。
附:本地插入图片步骤代码,
1.新建images,放入图片资源,如图位置:
2.在pubspec.yaml中找到"
# To add assets to your application, add an assets section, like this:
# assets:
"
大概在62行左右,去掉assets注释,注意格式。
3.main.drat代码片段
new Image.asset(
'images/p1.jpg',
width: 200,
height: 300,
),
注:此种情况下
main.dart代码
children: [
new Image.asset(
'images/imags/p2.png',
width: 200,
height: 300,
),
pubspec.yaml格式依旧如此