setFocusMode method

  1. @override
Future<void> setFocusMode(
  1. FocusMode mode
)
override

Set the focus mode of the device.

supportedFocusModes should be called before this.

Implementation

@override
Future<void> setFocusMode(FocusMode mode) {
  verifyInitialized();
  verifyNotDisposed();
  device.device.lockForConfiguration();
  switch (mode) {
    case FocusMode.fixed:
      device.device.setFocusMode(CaptureFocusMode.locked);
      break;
    case FocusMode.continuousImageAutoFocus:
      device.device.setFocusMode(CaptureFocusMode.continuousAutoFocus);
      break;
    case FocusMode.continuousVideoAutoFocus:
      device.device.setFocusMode(CaptureFocusMode.continuousAutoFocus);
      break;
  }
  return device.device.unlockForConfiguration();
}