0 purchases
us states
us_states #
Simple Dart library to deal with state names and abbreviations.
Installation #
Add the following to dependencies section in your pubspec.yml:
us_states: ^1.2.0
copied to clipboard
Usage #
Note #
All methods that take a string are case-insensitive. No need to adjust case before passing string into a method.
Get a state's name from an abbreviation #
Returns null if not found.
USStates.getName("IA");
// returns "Iowa"
copied to clipboard
Get a state's abbreviation from name #
Returns null if not found.
USStates.getAbbreviation("Iowa");
// returns "IA"
copied to clipboard
Get a list of all state names #
USStates.getAllNames();
// returns ["Alaska", "Alabama", ...]
copied to clipboard
Get a list of all state abbreviations #
USStates.getAllAbbreviations();
// returns ["AK", "AL", ...]
copied to clipboard
Get a map with state abbreviations as keys and names as values #
USStates.getAbbreviationMap();
// returns {"AK": "Alaska", "AL": "Alabama", ...}
copied to clipboard
Get a map with state names as keys and abbreviations as values #
USStates.getNameMap();
// returns {"Alaska": "AK", "Alabama": "AL", ...}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.