supportedFocusModes method

  1. @override
Future<List<FocusMode>> supportedFocusModes()
override

Retrieve all supported focus modes for a device.

Implementation

@override
Future<List<FocusMode>> supportedFocusModes() async {
  verifyInitialized();
  verifyNotDisposed();
  final List<String> focusModes =
      await cameraParameters.getSupportedFocusModes();

  final List<FocusMode> supportedModes = <FocusMode>[];
  for (String mode in focusModes) {
    switch (mode) {
      case CameraParameters.focusModeFixed:
        supportedModes.add(FocusMode.fixed);
        break;
      case CameraParameters.focusModeContinuousPicture:
        supportedModes.add(FocusMode.continuousImageAutoFocus);
        break;
      case CameraParameters.focusModeContinuousVideo:
        supportedModes.add(FocusMode.continuousVideoAutoFocus);
        break;
    }
  }
  return supportedModes;
}