LocalizationService class

A LocalizationService service is responsible for extracting json values from Localized strings

The folder containing json files is assets/i18n by default. The localization files are generated by running the script 'flutter pub run localized:main -l comma separated locale codes -d dir path'

Properties

dirPath String?
final
hashCode int
The hash code for this object.
no setterinherited
locale Locale?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

load() Future<bool>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
translate(String key) String
Extracts the value out of a JSON file Requires key as a parameter to get the appropriate value.

Operators

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

Static Methods

delegate({List<Locale>? locales, String? dirPath}) LocalizationsDelegate<LocalizationService>
A LocalizationsDelegate delegate that creates an instance of this class
of(BuildContext context) LocalizationService?