LazyLocaleData class

This implements the very basic map-type operations which are used in locale lookup, and looks them up based on a URL that defines the external source.

Constructors

LazyLocaleData.new(LocaleDataReader _reader, Function _creationFunction, List<String> availableLocales)
The constructor. The _reader specifies where the data comes from. The _creationFunction creates the appropriate data type from the remote data (which typically comes in as a Map). The keys lists the set of remotely available locale names so we know which things can be fetched without having to check remotely.

Properties

availableLocales List<String>
In order to avoid a potentially remote call to see if a locale is available, we hold a complete list of all the available locales.
getter/setter pair
availableLocaleSet Set<String>
The set of available locales.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
keys List<String>
Returns the list of keys/locale names.
no setter
map Map
This holds the data we have loaded.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

containsKey(String locale) bool
Tests if we have data for the locale available. Note that this returns true even if the data is known to be available remotely but not yet loaded.
initLocale(String localeName) Future<void>
Initialize for locale. Internal use only. As a user, call initializeDateFormatting instead.
jsonData(Future<String> input) Future
Given a Future input whose value is expected to be a string in JSON form, return another future that parses the JSON into a usable format.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
unsupportedLocale(String localeName) → void
Throw an exception indicating that the locale has no data available, either locally or remotely.

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](String localeName) → dynamic
Returns the data stored for localeName. If no data has been loaded for localeName, throws an exception. If no data is available for localeName then throw an exception with a different message.