TranslatorDelegate class abstract

An abstract delegate class to provide translation capabilities. Implement this class to define how translations are fetched, cached, and stored.

Constructors

TranslatorDelegate()

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

cache() Future<String?>
Optionally provide a cached JSON source of previously translated strings. Default implementation returns null.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
save(String source) → void
Save the serialized translation cache. value is the JSON-encoded string of all translations.
toString() String
A string representation of this object.
inherited
translate(String source, Locale locale) Future<String>
Translate a given source string to the target locale. Returns the translated string asynchronously.
translated(String key, String value) → void
Callback triggered when a translation is completed. key is the original string, value is the translated string.

Operators

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