us_states 1.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 74

us_states #

Simple Dart library to deal with state names and abbreviations.

CircleCI

Installation #

Add the following to dependencies section in your pubspec.yml:

  us_states: ^1.0.2

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 empty string if not found.

USStates.getName("IA");
// returns "Iowa"

Get a state's abbreviation from name #

Returns empty string if not found.

USStates.getAbbreviation("Iowa");
// returns "IA"

Get a list of all state names #

USStates.getAllNames();
// returns ["Alaska", "Alabama", ...]

Get a list of all state abbreviations #

USStates.getAllAbbreviations();
// returns ["AK", "AL", ...]

Get a map with state abbreviations as keys and names as values #

USStates.getAbbreviationMap();
// returns {"AK": "Alaska", "AL": "Alabama", ...}

Get a map with state names as keys and abbreviations as values #

USStates.getNameMap();
// returns {"Alaska": "AK", "Alabama": "AL", ...}

[1.0.3] - 08/01/2019

  • Dropping flutter-only requirement.

[1.0.2] - 08/01/2019

  • Added basic examples.

[1.0.1] - 08/01/2019

  • README adjustment.

[1.0.0] - 08/01/2019

  • It is ALIVE!

example/example.dart

import 'package:us_states/us_states.dart';

main() {
  print(USStates.getName("IA"));
  print(USStates.getAbbreviation("Iowa"));
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  us_states: ^1.0.3

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:us_states/us_states.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
47
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
74
Learn more about scoring.

We analyzed this package on Dec 9, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.12.21

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
Dev dependencies
flutter_test