【发布时间】:2020-12-24 12:53:55
【问题描述】:
我想在选择后删除图像,但执行此操作后会显示此错误,并且图像容器返回错误屏幕
'package:flutter/src/painting/image_provider.dart':断言失败: 第 854 行 pos 14: 'file != null': is not true.
这是我用来删除图像并显示图像的方法
Container(
height: MediaQuery.of(context).size.height * 0.2, //list height
child: ListView.builder(
itemCount: uploadedFilesList.length,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: Column(
children: [
InkWell(
onTap: () {
setState(() {
uploadedFilesList[index] = null;
});
},
child: Icon(Icons.close)),
Image.file(
uploadedFilesList[index],
width: MediaQuery.of(context).size.width * .25,
height: MediaQuery.of(context).size.height * .2,
),
],
),
),
);
},
),
),
谁能告诉我我的代码哪里出了问题?
【问题讨论】:
标签: flutter dart imagepicker