constrain method

  1. @override
MapCamera constrain(
  1. MapCamera camera
)
override

Create a new constrained camera based off the current camera

May return null if no appropriate camera could be generated by movement, for example because the camera was zoomed too far out.

Implementation

@override
MapCamera constrain(MapCamera camera) => camera.withPosition(
      center: LatLng(
        camera.center.latitude.clamp(
          bounds.south,
          bounds.north,
        ),
        camera.center.longitude.clamp(
          bounds.west,
          bounds.east,
        ),
      ),
    );