JsonLocalizations class

A class that reads JSON-based localization files.

Constructors

JsonLocalizations(String assetPath, [dynamic assetBundle])
Initialize with asset path to JSON files and an optional assetBundle.

Properties

assetBundle AssetBundle
The asset bundle.
final
assetPath String
Path to the translation file.
final
hashCode int
The hash code for this object.
no setterinherited
langTag String
A language tag for the current locale.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
translations Map<String, dynamic>
Translations per language tag.
final

Methods

load(Locale locale) Future<JsonLocalizations>
Load and cache a JSON file given a locale.
loadFile(Locale locale) Future<Map<String, dynamic>>
Load a JSON file from the asset bundle and parse it into a map.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
value(String key) → dynamic
Get translation given a key.

Operators

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

Static Methods

of(BuildContext context) JsonLocalizations?
Helper for getting JsonLocalizations object.