getTranslated function

String getTranslated(
  1. BuildContext context,
  2. dynamic key
)

to translate requested string value into selected local language

Implementation

String getTranslated(BuildContext context, var key) {
  if (DemoLocalization.of(context) != null) {
    return DemoLocalization.of(context)!.translate(key);
  } else {
    return key.last.toString();
  }
}