regionsIn method

List<RegionFeature> regionsIn(
  1. dynamic id, [
  2. bool strict = false
])

Returns the region matching id and all regions it contains, if any. If passing true for strict, an exact match will not be included.

Implementation

List<RegionFeature> regionsIn(dynamic id, [bool strict = false]) {
  final region = regionForID(id);
  if (region == null) return [];

  final List<RegionFeature> result = [];

  if (!strict) result.add(region);

  for (final memberId in region.members) {
    result.add(regionsByCode[memberId]!);
  }

  return result;
}