setTorch method
Implementation
Future<void> setTorch(TorchMode mode) async {
if (!value.isInitialized! || _isDisposed) {
throw CameraException(
'Uninitialized CameraController',
'resumeVideoRecording was called on uninitialized CameraController',
);
}
String methodName = (mode == TorchMode.off) ? 'setTorchOff' : 'setTorchOn';
try {
await _channel.invokeMethod<void>(
methodName,
null,
);
} on PlatformException catch (e) {
throw CameraException(e.code, e.message);
}
}