L10n class

Manages resources required for localization.

For each Locale, place the yaml file in the directory specified by I18nEnvironment.l10nPaths. The file name becomes the identifier returned by Locale.toLanguageTag and is normalized by Intl.canonicalizedLocale.

This class is automatically created during the load of L10nDelegate and loads each resource.

Constructors

L10n.new(Locale _locale, Map<String, Object> _map)
const

Properties

hashCode int
The hash code for this object.
no setterinherited
locale Locale
The Locale supported by this L10n.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

containsMessageKey(String key) bool
Returns true if key is defined in the yaml file.
lookup(String key, {Map<String, Object>? namedParameters}) String
Returns a string specified by key from the loaded yaml file.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

containsKey({required BuildContext context, required String key}) bool
Returns true if key is defined in the yaml file.
fromAssets({required Locale locale, required List<String> paths, AssetBundle? assetBundle}) Future<L10n>
Load the yaml file corresponding to Locale from the asset.