states_and_ut_india
A simple Dart library to convert state names to abbreviations and vice-versa
Installation
Add the following to dependencies
section in your pubspec.yml:
states_and_ut_india: ^1.0.1
Usage
Note
- All methods that take a string are case-insensitive.
Get a state's abbreviation from name
Returns empty string if not found.
INStates.getAbbreviation("Karnataka");
// returns "KA"
Get a state's name from an abbreviation
Returns empty string if not found.
INStates.getName("KA");
// returns "Karnataka"
Get a list of all state abbreviations
INStates.getAllAbbreviationsList();
// returns ["AP", "AN", ...]
Get a list of all state names
INStates.getAllStateNamesList();
// returns ["Andhra Pradesh", "Andaman and Nicobar Islands", ...]
Get a map with state abbreviations as keys and names as values
INStates.getAbbreviationMap();
// returns {"AP": "Andhra Pradesh", "AN": "Andaman and Nicobar Islands", ...}
Get a map with state names as keys and abbreviations as values
INStates.getNameMap();
// returns {"Andhra Pradesh": "AP", "Andaman and Nicobar Islands": "AN", ...}
Note
- This app is inspired by us_states.