getText method

String getText(
  1. String value,
  2. String context, {
  3. Map<String, dynamic>? attributes,
})

Utility method to return a translated string from a value. A context value will define it's transformation. E.g.: a context 'button' will return a title cased translated string.

Implementation

String getText(String value, String context,
    {Map<String, dynamic>? attributes}) {
  switch (context) {
    case "dialogTitle":
    case "dialogButton":
    case "appBar":
    case "label":
    case "hintText":
    case "helperText":
    case "prefixText":
    case "errorMessage":
    case "titleMessage":
    case "message":
    case "listTile":
    case "menu":
      return Strings.getCapitalized(value, attributes: attributes);
    case "title":
    case "button":
      return Strings.getTitle(value, attributes: attributes);
    default:
      return Strings.get(value, attributes: attributes);
  }
}