startWithOptions method

Future<int?> startWithOptions(
  1. CameraOptions options, {
  2. bool autoRequestPermission = true,
})

Starts the camera with granular, fully-customized native options.

Implementation

Future<int?> startWithOptions(
  CameraOptions options, {
  bool autoRequestPermission = true,
}) async {
  return _mutex.protect(() async {
    if (autoRequestPermission) {
      final granted = await NexoraSdkPlatform.instance
          .requestCameraPermission();
      if (!granted) return null;
    }
    return NexoraSdkPlatform.instance.startCameraWithOptions(options).then((
      result,
    ) {
      if (result is int) {
        _isRunning = true;
        return result;
      }
      return null;
    });
  });
}