filterInsideRadius static method

List<LatLng> filterInsideRadius(
  1. List<LatLng> locations,
  2. LatLng fromCenter,
  3. double radius, {
  4. DistanceAlgorithmType algorithm = DistanceAlgorithmType.Haversine,
  5. LengthUnit unit = LengthUnit.M,
})

Implementation

static List<LatLng> filterInsideRadius(
  List<LatLng> locations,
  LatLng fromCenter,
  double radius, {
  DistanceAlgorithmType algorithm = DistanceAlgorithmType.Haversine,
  LengthUnit unit = LengthUnit.M,
}) {
  List<LatLng> result = [];

  for (LatLng location in locations) {
    if (isInsideRadius(location, fromCenter, radius,
        algorithm: algorithm, unit: unit)) {
      result.add(location);
    }
  }

  return result;
}