autoFocus method
Starts camera auto-focus and registers a callback function to run when the camera is focused.
This method is only valid when preview is active (between startPreview and before stopPreview).
Callers should check CameraParameters.getFocusMode to determine if
this method should be called. If the camera does not support auto-focus,
it is a no-op and callback
will be called immediately.
If your application should not be installed on devices without auto-focus, you must declare that your application uses auto-focus with the <uses-feature> manifest element.
If the current flash mode is not CameraParameters.flashModeOff, flash may be fired during auto-focus, depending on the driver and camera hardware.
Auto-exposure lock CameraParameters.getAutoExposureLock and auto-white balance locks CameraParameters.getAutoWhiteBalanceLock do not change during and after auto-focus. But auto-focus routine may stop auto-exposure and auto-white balance transiently during focusing.
Stopping preview with stopPreview, or triggering still image capture with takePicture, will not change the the focus position. Applications must call cancelAutoFocus to reset the focus.
If auto-focus is successful, consider playing back an auto-focus success sound to the user.
Throws PlatformException if starting autofocus fails; usually this would be because of a hardware or other low-level error, or because release has been called on this Camera instance.
Implementation
Future<void> autoFocus(AutoFocusCallback callback) {
ChannelRegistrar.instance.implementations.channelAutoFocusCallback.$$create(
callback,
$owner: false,
);
return _channel.$autoFocus(this, callback);
}