TranslationLoader class abstract
The Translation Loader Contract.
Defines the interface for loading translation files from various sources (assets, network, database, etc.).
Implementation
class JsonAssetLoader implements TranslationLoader {
@override
Future<Map<String, dynamic>> load(Locale locale) async {
final json = await rootBundle.loadString('assets/lang/${locale.languageCode}.json');
return jsonDecode(json);
}
}
- Implementers
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
load(
Locale locale) → Future< Map< String, dynamic> > - Load translations for the given locale.
-
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