getProvinceById function

Province? getProvinceById(
  1. int id
)

Optional: Helper function to find a province by its unique id.

Returns the Province object with the matching id, or null if no province is found.

Implementation

Province? getProvinceById(int id) {
  return slProvinces.firstWhere(
    (province) => province.id == id,
  );
}