getImage method
Returns an XFile
with the image that was picked.
The source
argument controls where the image comes from. This can
be either ImageSource.camera
or ImageSource.gallery
.
Note that the maxWidth
, maxHeight
and imageQuality
arguments are not supported on the web. If any of these arguments is supplied, it'll be silently ignored by the web version of the plugin.
Use preferredCameraDevice
to specify the camera to use when the source
is ImageSource.camera
.
The preferredCameraDevice
is ignored when source
is ImageSource.gallery
. It is also ignored if the chosen camera is not supported on the device.
Defaults to CameraDevice.rear
.
If no images were picked, the return value is null.
Implementation
@override
@Deprecated('Use getImageFromSource instead.')
Future<XFile?> getImage({
required ImageSource source,
double? maxWidth,
double? maxHeight,
int? imageQuality,
CameraDevice preferredCameraDevice = CameraDevice.rear,
}) async {
return getImageFromSource(
source: source,
options: ImagePickerOptions(
maxWidth: maxWidth,
maxHeight: maxHeight,
imageQuality: imageQuality,
preferredCameraDevice: preferredCameraDevice,
));
}