takePicture method Null safety

  1. @override
Future<XFile> takePicture(
  1. int cameraId
)
override

Captures an image and returns the file where it was saved.

Implementation

@override
Future<XFile> takePicture(int cameraId) {
  try {
    return getCamera(cameraId).takePicture();
  } on html.DomException catch (e) {
    throw PlatformException(code: e.name, message: e.message);
  } on CameraWebException catch (e) {
    _addCameraErrorEvent(e);
    throw PlatformException(code: e.code.toString(), message: e.description);
  }
}