flipCamera method

Future<void> flipCamera()

Changes lens on the current controller unless it is recording.

Implementation

Future<void> flipCamera() => useController((controller) async {
  if (controller.value.isRecordingVideo) return;
  final other = _cameras.firstWhereOrNull(
    (camera) => camera.lens != controller.description.lens,
  );
  if (other == null) return;
  await controller.setDescription(other);
  await controller.lockCaptureOrientation(DeviceOrientation.portraitUp);
  if (!_closed) notifyListeners();
});