每次从摄像头采集图像时,Flutter应用程序都会重启。为此,我们使用了图像拾取器插件。版本:^0.6.7+12。
这主要是在2 2GB设备中观察到的。请帮助解决此问题。提前谢谢你。
发布于 2021-06-05 23:09:54
我认为这可能是由于内存不足造成的。
在Android系统上处理MainActivity销毁--尽管很少--有时会在image_picker结束后杀死MainActivity。发生这种情况时,我们会丢失从image_picker中选择的数据。在这种情况下,您可以使用retrieveLostData找回丢失的数据。例如:
Future<void> retrieveLostData() async {
final LostData response =
await picker.getLostData();
if (response.isEmpty) {
return;
}
if (response.file != null) {
setState(() {
if (response.type == RetrieveType.video) {
_handleVideo(response.file);
} else {
_handleImage(response.file);
}
});
} else {
_handleError(response.exception);
}
}
https://stackoverflow.com/questions/67850871
复制相似问题