FakeImagePickerPlatform class
A fake ImagePickerPlatform for e2e and integration testing.
When installed, calls to ImagePicker.pickImage will return a tiny test PNG
instead of opening the system file picker (which hangs on macOS desktop).
Usage:
FakeImagePickerPlatform.install();
- Inheritance
-
- Object
- PlatformInterface
- FakeImagePickerPlatform
- Mixed-in types
-
- MockPlatformInterfaceMixin
Constructors
- FakeImagePickerPlatform()
- Creates a FakeImagePickerPlatform with a default 1x1 test PNG written to a temp file.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- imageToReturn ↔ XFile?
-
The
XFilethat getImageFromSource will return. Set tonullto simulate the user cancelling the picker.getter/setter pair - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getImage(
{required ImageSource source, double? maxWidth, double? maxHeight, int? imageQuality, CameraDevice preferredCameraDevice = CameraDevice.rear}) → Future< XFile?> -
Returns an
XFilewith the image that was picked.inherited -
getImageFromSource(
{required ImageSource source, ImagePickerOptions options = const ImagePickerOptions()}) → Future< XFile?> -
Returns an
XFilewith the image that was picked. -
getLostData(
) → Future< LostDataResponse> - Retrieves any previously picked files, that were lost due to the MainActivity being destroyed. (Android only)
-
getMedia(
{required MediaOptions options}) → Future< List< XFile> > -
Returns a List<XFile> with the images and/or videos that were picked.
The images and videos come from the gallery.
inherited
-
getMultiImage(
{double? maxWidth, double? maxHeight, int? imageQuality}) → Future< List< XFile> ?> -
Returns a List<XFile> with the images that were picked.
inherited
-
getMultiImageWithOptions(
{MultiImagePickerOptions options = const MultiImagePickerOptions()}) → Future< List< XFile> > - Returns a List<XFile> with the images that were picked.
-
getMultiVideoWithOptions(
{MultiVideoPickerOptions options = const MultiVideoPickerOptions()}) → Future< List< XFile> > -
Returns a List<XFile> with the videos that were picked.
inherited
-
getVideo(
{required ImageSource source, CameraDevice preferredCameraDevice = CameraDevice.rear, Duration? maxDuration}) → Future< XFile?> -
Returns a
XFilecontaining the video that was picked. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pickImage(
{required ImageSource source, double? maxWidth, double? maxHeight, int? imageQuality, CameraDevice preferredCameraDevice = CameraDevice.rear}) → Future< PickedFile?> -
Returns a
PickedFilewith the image that was picked.inherited -
pickMultiImage(
{double? maxWidth, double? maxHeight, int? imageQuality}) → Future< List< PickedFile> ?> -
Returns a List<PickedFile> with the images that were picked.
inherited
-
pickVideo(
{required ImageSource source, CameraDevice preferredCameraDevice = CameraDevice.rear, Duration? maxDuration}) → Future< PickedFile?> -
Returns a
PickedFilecontaining the video that was picked.inherited -
retrieveLostData(
) → Future< LostData> -
Retrieves any previously picked file, that was lost due to the MainActivity being destroyed.
In case multiple files were lost, only the last file will be recovered. (Android only).
inherited
-
supportsImageSource(
ImageSource source) → bool -
Returns true if the implementation supports
source.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
install(
) → FakeImagePickerPlatform -
Installs this fake as the active
ImagePickerPlatform.instance.