getDistrictById function

District? getDistrictById(
  1. int id
)

Returns the District object with the matching id, or null if no district is found.

Implementation

District? getDistrictById(int id) {
  return slDistricts.firstWhere(
    (district) => district.id == id,
  );
}