switchCamera method
switch CameracameraId`.
This switch Camera to the camera with the given cameraId.
Throws a CameraException if the capture fails.
Implementation
Future<void> switchCamera(String cameraId) async {
if (!value.isInitialized! || _isDisposed) {
throw CameraException(
'Uninitialized CameraController',
'switchCamera was called on uninitialized CameraController',
);
}
try {
await _channel
.invokeMethod<void>('switchCamera', <String, dynamic>{
'cameraName': cameraId
});
} on PlatformException catch (e) {
throw CameraException(e.code, e.message);
}
}