LatLngBounds.unsafe constructor

LatLngBounds.unsafe({
  1. required double north,
  2. required double south,
  3. required double east,
  4. required double west,
})

Create a LatLngBounds instance from raw edge values.

Potentially throws assertion errors if the coordinates exceed their max or min values or if coordinates are meant to be smaller / bigger but aren't.

Implementation

LatLngBounds.unsafe({
  required this.north,
  required this.south,
  required this.east,
  required this.west,
})  : 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(east <= maxLongitude,
          "The east longitude can't be bigger than $maxLongitude: $east"),
      assert(east >= minLongitude,
          "The east longitude can't be smaller than $minLongitude: $east"),
      assert(west <= maxLongitude,
          "The west longitude can't be bigger than $maxLongitude: $west"),
      assert(west >= minLongitude,
          "The west longitude can't be smaller than $minLongitude: $west"),
      assert(
        north >= south,
        "The north latitude ($north) can't be smaller than the "
        'south latitude ($south)',
      ),
      assert(
        east >= west,
        "The west longitude ($west) can't be smaller than the "
        'east longitude ($east)',
      );