toSubBounds method

List<GoogleMapsUtilsLatLngBounds> toSubBounds(
  1. GoogleMapsUtilsLatLngBounds bounds, {
  2. int division = 2,
})

Splits bounds into a grid of division² sub-bounds.

Returns a list of GoogleMapsUtilsLatLngBounds records.

Implementation

List<GoogleMapsUtilsLatLngBounds> toSubBounds(GoogleMapsUtilsLatLngBounds bounds, {int division = 2}) {
  final internal = LatLngBoundsModel(
    northEast: bounds.ne,
    southWest: bounds.sw,
  );
  return SphericalUtils.toSubBounds(internal, division: division)
      .map((b) => (ne: b.northEast, sw: b.southWest))
      .toList();
}