I am trying to use the image_picker on flutter app everything is fine until gallery open i choose the image then the app will crash and restart.
before this it was working fine like 1 month ago but now it is not. is there any solution
this is my code.
Future _pickImage() async {
try {
final image = await ImagePicker().pickImage(source: ImageSource.gallery);
if (image == null) return;
final imageTemporary = File(image.path);
setState(() {
_image = imageTemporary;
});
} catch (error) {
print("error: $error");
}
// setState(() {
// _image = img;
// });
}
File? _image;
Future _pickImage() async {
try {
final image = await ImagePicker().pickImage(source: ImageSource.gallery);
if (image == null) return;
final imageTemporary = File(image.path);
setState(() {
_image = imageTemporary;
});
} catch (error) {
print("error: $error");
}
}