MediaPicker class abstract final

Wraps ImagePicker with a clean, immutable-result API.

All methods return MediaFile (or null / a list), without exposing the underlying XFile or PickedFile types.

final file = await MediaPicker.pickImage();
if (file != null) {
  // use file.path, file.sizeBytes, etc.
}

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

pickImage({ImageSource source = ImageSource.gallery, int? maxWidth, int? maxHeight, int? imageQuality, bool requestFullMetadata = false}) Future<MediaFile?>
Opens the system image picker and returns the chosen image as MediaFile.
pickMultipleImages({int? maxWidth, int? maxHeight, int? imageQuality, int? limit}) Future<List<MediaFile>>
Opens the system multi-image picker.
pickVideo({ImageSource source = ImageSource.gallery, Duration? maxDuration}) Future<MediaFile?>
Opens the system video picker.
recordVideo({Duration? maxDuration}) Future<MediaFile?>
Opens the camera to record a video.
takePhoto({int? imageQuality}) Future<MediaFile?>
Opens the camera to take a photo.