isInsideCountry function

Future<GeoRelation> isInsideCountry(
  1. LatLng point,
  2. String countryCode
)

Check if a point is inside a country @param {LatLng} point @param {String} countryCode @returns {Future

Implementation

Future<GeoRelation> isInsideCountry(LatLng point, String countryCode) async {
  List<List<List<LatLng>>>? boundaries = _boundaries[countryCode];
  if (boundaries == null) {
    boundaries = await _loadBoundary(countryCode);
    if (boundaries != null) {
      _boundaries[countryCode] = boundaries;
    }
  }
  if (boundaries == null) {
    return GeoRelation(double.infinity, false);
  }
  return _isPointInBoundary(point, boundaries);
}