MultiLanguage class
A class that manages the loading and parsing of multi-language JSON files from a specified directory path.
The MultiLanguage class provides functionality to load, read, and parse JSON files to create a map structure representing different language data.
Example usage:
final multiLanguage = MultiLanguage('/path/to/languages');
final translations = await multiLanguage.init();
Constructors
- MultiLanguage(String languagePath)
-
Creates an instance of MultiLanguage with the given
languagePath
.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- languagePath ↔ String
-
The directory path where the language JSON files are stored.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
init(
) → Future< Map< String, Map< >String, String> > - Initializes the multi-language system by reading all JSON files from the directory and subdirectories specified in languagePath.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
readFile(
String path, Map< String, Map< result) → Future<String, String> >Map< String, Map< >String, String> > -
Reads and parses a JSON file at the given
path
and merges its data intoresult
. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited