Simple Dart library to deal with state names and abbreviations.
Add the following to dependencies
section in your pubspec.yml:
us_states: ^1.2.0
- All methods that take a string are case-insensitive. No need to adjust case before passing string into a method.
Returns null if not found.
USStates.getName("IA");
// returns "Iowa"
Returns null if not found.
USStates.getAbbreviation("Iowa");
// returns "IA"
USStates.getAllNames();
// returns ["Alaska", "Alabama", ...]
USStates.getAllAbbreviations();
// returns ["AK", "AL", ...]
USStates.getAbbreviationMap();
// returns {"AK": "Alaska", "AL": "Alabama", ...}
USStates.getNameMap();
// returns {"Alaska": "AK", "Alabama": "AL", ...}