getStateById method

Future<StateModel?> getStateById(
  1. String id
)

Implementation

Future<StateModel?> getStateById(String id) async {
  final states = await loadStates();
  try {
    return states.firstWhere((state) => state.id == id);
  } catch (e) {
    return null;
  }
}