Skip to content

Instantly share code, notes, and snippets.

@jtmuller5
Created March 25, 2021 22:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtmuller5/bfb6a9c33ddff75cbc551742a7321181 to your computer and use it in GitHub Desktop.
Save jtmuller5/bfb6a9c33ddff75cbc551742a7321181 to your computer and use it in GitHub Desktop.
@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