I have two image buttons in flutter application to pick images from the gallery, when I press anyone ImageButton and try to select the image it gets picked successfully. and after that when I try to use other imagebutton to pick another image the app gets crashed in iOS
To pick the image everytime the different calls are done for getting the image.
Below are the methods called everytime
Future getImage2() async {
print("get image");
PickedFile image = await _picker2.getImage(source: ImageSource.gallery);
// File image = await ImagePicker.pickImage(source: ImageSource.gallery);
if (image != null) {
setState(() {
final File file = File(image.path);
avatarImageFile2 = file;
isLoading2 = true;
});
}
}
Future getImage1() async {
print("get image");
PickedFile image = await _picker1.getImage(source: ImageSource.gallery);
// File image = await ImagePicker.pickImage(source: ImageSource.gallery);
if (image != null) {
setState(() {
final File file = File(image.path);
avatarImageFile1 = file;
isLoading1 = true;
});
}
}
please guide how should I resolve it