isCityInDistrict function

bool isCityInDistrict(
  1. int cityId,
  2. int districtId
)

Returns true if the city belongs to that district, otherwise false.

Implementation

bool isCityInDistrict(int cityId, int districtId) {
  final city = getCityById(cityId);
  if (city == null) return false;
  return city.districtId == districtId;
}