switchCamera method
Switch between front and back camera
Implementation
@override
Future<Map<String, dynamic>> switchCamera(CameraPosition position) async {
try {
if (kDebugMode) {
debugPrint('QuickQR Scanner: Switching to ${position.value} camera');
}
final result = await methodChannel.invokeMethod<Map<Object?, Object?>>(
'switchCamera',
{'position': position.value}
);
final cameraState = Map<String, dynamic>.from(result ?? {});
if (kDebugMode) {
debugPrint('QuickQR Scanner: Camera switched - $cameraState');
}
return cameraState;
} on PlatformException catch (e) {
throw _handlePlatformException(e, 'switchCamera');
} catch (e) {
throw ScannerException(
ScannerErrorCode.internalError,
'Failed to switch camera: $e',
);
}
}