toBoundsFromPoints static method
Convert a list of latitudes and longitudes to an object of boundaries
see: https://github.com/flutter/flutter/issues/36653#issuecomment-525288053
Returns The boundaries from the list of points
Implementation
static GMULatLngBounds toBoundsFromPoints(List<Point<double>> points) {
if (points.isEmpty) throw Exception("Points cannot be empty");
double x0, x1, y0, y1;
x0 = x1 = points.first.x;
y0 = y1 = points.first.y;
points.forEach((point) {
if (point.x > x1) x1 = point.x;
if (point.x < x0) x0 = point.x;
if (point.y > y1) y1 = point.y;
if (point.y < y0) y0 = point.y;
});
final northEast = Point<double>(x1, y1);
final southWest = Point<double>(x0, y0);
final gmuLatLngBounds = GMULatLngBounds(
northEast: northEast,
southWest: southWest,
);
return gmuLatLngBounds;
}