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<int> focusModes = await device.device.focusModesSupported(<int>[
    CaptureFocusMode.locked,
    CaptureFocusMode.continuousAutoFocus,
  ]);

  final List<FocusMode> supportedModes = <FocusMode>[];
  for (int mode in focusModes) {
    switch (mode) {
      case CaptureFocusMode.locked:
        supportedModes.add(FocusMode.fixed);
        break;
      case CaptureFocusMode.continuousAutoFocus:
        supportedModes.add(FocusMode.continuousImageAutoFocus);
        supportedModes.add(FocusMode.continuousVideoAutoFocus);
        break;
    }
  }
  return supportedModes;
}