Skip to content

Instantly share code, notes, and snippets.

@jtmuller5
Created March 25, 2021 22:44
Embed
What would you like to do?
@injectable
class MediaService {
final picker = ImagePicker();
/// Select an image from the user's device
Future<File> selectImage({ImageSource source = ImageSource.gallery}) async {
final pickedFile = await picker.getImage(source: source);
if(pickedFile!= null) {
return File(pickedFile.path);
} else {
return null;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment