Navaron Bracke

do nothing in setTorchState if torch is not available

@@ -192,6 +192,10 @@ class MethodChannelMobileScanner extends MobileScannerPlatform { @@ -192,6 +192,10 @@ class MethodChannelMobileScanner extends MobileScannerPlatform {
192 192
193 @override 193 @override
194 Future<void> setTorchState(TorchState torchState) async { 194 Future<void> setTorchState(TorchState torchState) async {
  195 + if (torchState == TorchState.unavailable) {
  196 + return;
  197 + }
  198 +
195 await methodChannel.invokeMethod<void>('torch', torchState.rawValue); 199 await methodChannel.invokeMethod<void>('torch', torchState.rawValue);
196 } 200 }
197 201