cameraForLatLngBounds method

Future<CameraOptions> cameraForLatLngBounds(
  1. LatLngBounds bounds, {
  2. CameraFitOptions? fitOptions,
})

Computes a camera that fits bounds in the map's view.

The camera keeps the map's bearing and pitch unless fitOptions sets them, and its zoom stays within the map's zoom limits.

See mln_map_camera_for_lat_lng_bounds in the C API reference.

Errors:

  • Status.invalidArgument when the padding in fitOptions leaves no room for the area.

Implementation

Future<CameraOptions> cameraForLatLngBounds(
  LatLngBounds bounds, {
  CameraFitOptions? fitOptions,
}) => _query(
  _resultCameraOptions,
  (arena, completion) => raw.mln_map_camera_for_lat_lng_bounds(
    _handle.raw,
    _writeLatLngBounds(bounds, arena).ref,
    fitOptions == null ? nullptr : _writeCameraFitOptions(fitOptions, arena),
    completion,
    nativeDiagnostic,
  ),
);