changeCamera method

  1. @override
Future<void> changeCamera(
  1. CameraType cameraType
)
override

Switches the camera to the specified CameraType.

Throws an Exception if the camera switch fails.

Implementation

@override
Future<void> changeCamera(CameraType cameraType) async {
  try {
    await methodChannel.invokeMethod<void>('changeCamera', <String, dynamic>{
      'type': cameraType.index.toString(),
    });
  } catch (e) {
    throw Exception("Unable to change the camera [Change Camera]");
  }
}