isGeoPointInBoundingBox static method

bool isGeoPointInBoundingBox(
  1. LatLng l,
  2. LatLng topLeft,
  3. LatLng bottomRight
)

Checks if a given geo point is inside the bounding box defined by the top-left and bottom-right corners.

l - The LatLng coordinates of the point to check.

topLeft - The LatLng coordinates of the top-left corner of the bounding box.

bottomRight - The LatLng coordinates of the bottom-right corner of the bounding box.

Returns true if the point is within the bounding box; otherwise, returns false.

Implementation

static bool isGeoPointInBoundingBox(
    LatLng l, LatLng topLeft, LatLng bottomRight) {
  return (bottomRight.latitude <= l.latitude &&
          l.latitude <= topLeft.latitude) &&
      (topLeft.longitude <= l.longitude &&
          l.longitude <= bottomRight.longitude);
}