L10n class

The Localization Class

Inheritance

Constructors

L10n()
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type Type
The type of the object returned by the load method, T by default.
no setterinherited

Methods

isSupported(Locale locale) bool
Indicate to the Flutter framework this delegate can support the passed Locale.
override
load([Locale? locale]) Future<L10n>
Start loading the resources for locale. The returned future completes when the resources have finished loading.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
shouldReload(covariant L10n old) bool
Reload if the local has changed.
override
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

allowDeviceChangeLocale bool
A flag allowing the Locale to change dynamically or not.
getter/setter pair
backupLocale Locale?
Supply the 'backup' Locale if any.
getter/setter pair
delegate LocalizationsDelegate<L10n>
Supply the Localization Delegate (It's itself!)
no setter
deviceLocale Locale?
Intended to store the device's original Locale.
no setter
locale Locale
The current Locale
getter/setter pair
prevLocale Locale
The previous Locale
no setter
supportedLocales List<Locale>
Supported Locales
getter/setter pair
translations Map<Locale, Map<String, String>>
The app's translations
getter/setter pair

Static Methods

appendTranslations(Map<Locale, Map<String, String>> tr) → void
Add additional Translations Overwrite existing Translation
getLocale(int index) Locale?
Get a Locale from the List of 'supported' Locales.
localeResolutionCallback(Locale? preferredLocale, Iterable<Locale>? supportedLocales) Locale?
Called by the LocalizationsDelegate. Possibly needed to resolve current Locale.
of(BuildContext context) L10n?
Return an instance of the L10Locale class Really not needed. L10n. prefix can be used instead. Merely for conformity.
s(String? word) String
Translate the String
t(String? data, {Key? key, TextStyle? style, StrutStyle? strutStyle, TextAlign? textAlign, TextDirection? textDirection, Locale? locale, bool? softWrap, TextOverflow? overflow, double? textScaleFactor, int? maxLines, String? semanticsLabel, TextWidthBasis? textWidthBasis, TextHeightBehavior? textHeightBehavior}) Text
Supply a Text object for the translation.
toLocale(String? _locale) Locale?
Return a Locale object from the provided String
translate(String word) String
Possibly translate the supplied word.