showPicker method

  1. @override
Future<File> showPicker({
  1. required SourceType source,
  2. double? width,
  3. double? height,
  4. int? imageQuality,
})
override

Implementation

@override
Future<File> showPicker(
    {required SourceType source,
    double? width,
    double? height,
    int? imageQuality}) async {
  Map<String, dynamic> args = {
    'source': source.name,
    'width': width,
    'height': height,
    'imageQuality': imageQuality
  };
  CameraDevice? preferredCameraDevice;
  if (source == SourceType.front) {
    preferredCameraDevice = CameraDevice.front;
  } else if (source == SourceType.back) {
    preferredCameraDevice = CameraDevice.rear;
  }
  String? result;
  if (Platform.isAndroid) {
    result = await _pickerService.pickImageFromCamera(
        width: width,
        height: height,
        imageQuality: imageQuality,
        preferredCameraDevice: preferredCameraDevice);
  } else if (Platform.isIOS) {
    result = await methodChannel.invokeMethod('showPicker', args);
  }

  return File(result!);
}