Localization class abstract
Constructors
- Localization({required String code, String? name, String? country})
-
Create a Localization instance
const
Properties
- code → String
-
The language code
final
- country → String?
-
The language country
final
- fullCode → String
-
Get the full code of this localization.
name
is not included in this. Code can not be null.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- name → String?
-
The language name
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toLocale(
) → Locale -
Transform
this
into aLocale
. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- basedOnSystem → Localization?
-
Returns the best option based on the system's language(s).
no setter
- currentLocalization ↔ Localization
-
Get the current localization
getter/setter pair
-
localizations
↔ List<
Localization> -
The supported localizations supported by the app.
You must add localizations to this if
basedOnSystem
is usedgetter/setter pair -
onLocaleChanged
→ Stream<
Localization> -
Listen to when the
currentLocalization
changesno setter -
systemLocales
→ List<
Locale> -
The full system-reported supported locales of the device.
no setter
Static Methods
-
get(
{required String code, String? country}) → Localization? -
Get a localization based on
code
andcountry
. -
getByCode(
String code) → Localization? - Get the localization based on the code. If there's more than one, it defaults to the first one
-
getByLocale(
Locale locale) → Localization? -
Get a localization that is equivalent to
locale
. If country is missing get the localization based on the code, otherwise get -
init(
) → void - Initialize the localization.
-
of(
BuildContext context) → Localization -
Get the current localizations based on the current context.
If null, defaults to
currentLocalization
.