trAsync method

Future<String> trAsync([
  1. Locale? locale
])

Asynchronously translates the string for a specific locale.

Returns the original string if translation is not available.

Example:

await "hello".trAsync(Locale('es')); // "Hola"

Implementation

Future<String> trAsync([Locale? locale]) {
  return Translation.translate(this, locale).then((value) => value ?? this);
}