isIn method

bool isIn({
  1. double? lon,
  2. double? lat,
  3. dynamic query,
  4. dynamic inside,
})

Implementation

bool isIn({double? lon, double? lat, dynamic query, dynamic inside}) {
  final queried = smallestOrMatchingRegion(lon: lon, lat: lat, query: query);
  final boundsRegion = region(query: inside);

  if (queried == null) return false; // Outside any of the regions.
  if (boundsRegion == null)
    throw StateError('Could not find bounds by query $inside');

  if (queried.id == boundsRegion.id) return true;
  return queried.groups.contains(boundsRegion.id);
}