locales 0.1.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 73

locales

Locale codes strings ("en_US") and ISO 4217 currency codes ("USD").

Example

import 'package:locales/locales.dart';
import 'package:locales/currency_codes.dart';
import 'package:intl/intl.dart';

void main() {
  final locale = Locale.en_US;
  final currencyCode = CurrencyCode.usd;
  final format = NumberFormat.simpleCurrency(
      locale: '$locale', name: '$currencyCode', decimalDigits: 2);
  print(locale);                  // en_US
  print(currencyCode);            // USD
  print(format.format(123.456));  // $123.46
}

[0.1.0] - September 22, 2018

  • Use the abbreviation as the constant (Locale.en_US) and make the long form a doc comment.

[0.0.3] - September 22, 2018

  • Make pub happy (longer package description)

[0.0.2] - September 22, 2018

  • Drop "s" suffix from class names. Locales => Locale CurrencyCodes => CurrencyCode

[0.0.1] - September 22, 2018

  • First release.

example/main.dart

import 'package:locales/locales.dart';
import 'package:locales/currency_codes.dart';
import 'package:intl/intl.dart';

void main() {
  final locale = Locale.en_US;
  final currencyCode = CurrencyCode.usd;
  final format = NumberFormat.simpleCurrency(
      locale: '$locale', name: '$currencyCode', decimalDigits: 2);
  print(locale); // en_US
  print(currencyCode); // USD
  print(format.format(123.456)); // $123.46
}

Use this package as a library

1. Depend on it

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


dependencies:
  locales: ^0.1.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:locales/locales.dart';
  
Version Uploaded Documentation Archive
0.1.0 Sep 22, 2018 Go to the documentation of locales 0.1.0 Download locales 0.1.0 archive
0.0.3 Sep 22, 2018 Go to the documentation of locales 0.0.3 Download locales 0.0.3 archive
0.0.2 Sep 22, 2018 Go to the documentation of locales 0.0.2 Download locales 0.0.2 archive
0.0.1 Sep 22, 2018 Go to the documentation of locales 0.0.1 Download locales 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
46
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]
73
Learn more about scoring.

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

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:locales/locales.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
Dev dependencies
intl ^0.15.7
test ^1.3.3