getImage method
Pick Image from Camera or gallery index 0->Gallery 1->Camera
Implementation
Future<PickedFile?> getImage(int index) async {
PickedFile? selectedFile;
if (kIsWeb) {
selectedFile = await ImagePicker().getImage(source: ImageSource.gallery);
} else {
if (index == 0)
selectedFile =
await ImagePicker().getImage(source: ImageSource.gallery);
else
selectedFile = await ImagePicker().getImage(source: ImageSource.camera);
}
if (selectedFile != null) {
return selectedFile;
} else {
return null;
}
}