setFocusPoint method Null safety

Future<void> setFocusPoint(
  1. Offset? point
)

Sets the focus point for automatically determining the focus value.

Supplying a null value will reset the focus point to it's default value.

Implementation

Future<void> setFocusPoint(Offset? point) async {
  if (point != null &&
      (point.dx < 0 || point.dx > 1 || point.dy < 0 || point.dy > 1)) {
    throw ArgumentError(
        'The values of point should be anywhere between (0,0) and (1,1).');
  }
  try {
    await CameraPlatform.instance.setFocusPoint(
      _cameraId,
      point == null
          ? null
          : Point<double>(
              point.dx,
              point.dy,
            ),
    );
  } on PlatformException catch (e) {
    throw CameraException(e.code, e.message);
  }
}