takePicture method
Future<CameraMacOSFile?>
takePicture({
- PictureFormat format = PictureFormat.tiff,
- PictureResolution resolution = PictureResolution.max,
override
Call this method to take a picture.
Implementation
@override
Future<CameraMacOSFile?> takePicture(
{PictureFormat format = PictureFormat.tiff,
PictureResolution resolution = PictureResolution.max}) async {
try {
final Map<String, dynamic>? result = await methodChannel
.invokeMapMethod<String, dynamic>('takePicture',
{'format': format.name, 'resolution': resolution.name});
if (result == null) {
throw FlutterError('Invalid result');
}
if (result['error'] != null) {
throw result['error'];
} else {
return CameraMacOSFile(bytes: result['imageData'] as Uint8List?);
}
} catch (e) {
return Future.error(e);
}
}