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();
  switch (mode) {
    case FocusMode.fixed:
      cameraParameters.setFocusMode(CameraParameters.focusModeFixed);
      break;
    case FocusMode.continuousImageAutoFocus:
      cameraParameters.setFocusMode(
        CameraParameters.focusModeContinuousPicture,
      );
      break;
    case FocusMode.continuousVideoAutoFocus:
      cameraParameters.setFocusMode(
        CameraParameters.focusModeContinuousVideo,
      );
      break;
  }
  return camera.setParameters(cameraParameters);
}