I18nService class

App-facing localization facade.

final i18n = I18nService(InMemoryI18n(table: myTable));
i18n.t('welcome.title', params: {'name': 'Ada'});
i18n.t('cart.items', pluralCount: 3);
await i18n.setLocale(const AppLocale('tr'));

Constructors

I18nService(I18nPort port)

Properties

hashCode → int
The hash code for this object.
no setterinherited
locale → AppLocale
The active locale.
no setter
port → I18nPort
The translator port.
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
onLocaleChanged(void listener(AppLocale locale)) → void Function()
Subscribes to locale changes; returns the unsubscribe function.
setLocale(AppLocale locale) → Future<void>
Switches the locale and notifies listeners.
t(String key, {Map<String, Object?> params = const {}, int? pluralCount}) → String
Translates key; returns the resolved text (the key itself when missing — never blanks).
toString() → String
A string representation of this object.
inherited
translate(String key, {Map<String, Object?> params = const {}, int? pluralCount}) → ResolvedMessage
Full-resolution variant (carries fallback info).

Operators

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