operator [] method

dynamic operator [](
  1. String localeName
)

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.

Implementation

dynamic operator [](String localeName) {
  if (containsKey(localeName)) {
    dynamic data = map[localeName];
    if (data == null) {
      throw LocaleDataException('Locale $localeName has not been initialized.'
          ' Call initializeDateFormatting($localeName, <data url>) first');
    } else {
      return data;
    }
  } else {
    unsupportedLocale(localeName);
  }
}