LatLngBounds.worldSafe constructor

LatLngBounds.worldSafe({
  1. required double north,
  2. required double south,
  3. required double longitudeCenter,
  4. required double longitudeWidth,
})

Creates bounds that can be larger than the world, longitude-wise.

Implementation

LatLngBounds.worldSafe({
  required this.north,
  required this.south,
  required this.longitudeCenter,
  required this.longitudeWidth,
})  : assert(north <= maxLatitude,
          "The north latitude can't be bigger than $maxLatitude: $north"),
      assert(north >= minLatitude,
          "The north latitude can't be smaller than $minLatitude: $north"),
      assert(south <= maxLatitude,
          "The south latitude can't be bigger than $maxLatitude: $south"),
      assert(south >= minLatitude,
          "The south latitude can't be smaller than $minLatitude: $south"),
      assert(longitudeCenter <= maxLongitude,
          "The longitude center can't be bigger than $maxLongitude: $longitudeCenter"),
      assert(longitudeCenter >= minLongitude,
          "The longitude center can't be smaller than $minLongitude: $longitudeCenter"),
      assert(longitudeWidth >= 0, 'The longitude width must be positive'),
      assert(
        north >= south,
        "The north latitude ($north) can't be smaller than the "
        'south latitude ($south)',
      ),
      east = min(longitudeCenter + longitudeWidth / 2, maxLongitude),
      west = max(longitudeCenter - longitudeWidth / 2, minLongitude);