switchFlashLight method

Future<void> switchFlashLight(
  1. bool isEnable
)

switch Flash Light

This switch Flash Light

Throws a CameraException if the capture fails.

Implementation

Future<void> switchFlashLight(bool isEnable) async {
  if (!value.isInitialized! || _isDisposed) {
    throw CameraException(
      'Uninitialized CameraController',
      'startVideoStreaming was called on uninitialized CameraController',
    );
  }
  if (!value.isStreamingVideoRtmp!) {
    throw CameraException(
      'No video is recording',
      'resumeVideoStreaming was called when no video is streaming.',
    );
  }
  try {
    await _channel
        .invokeMethod<void>('switchFlashLight', <String, dynamic>{
          'isEnable': isEnable
    });
  } on PlatformException catch (e) {
    throw CameraException(e.code, e.message);
  }
}