text method

String text(
  1. String? key, [
  2. Map<String, String?>? arguments
])

Implementation

String text(String? key, [Map<String, String?>? arguments]) {
  String extraText = "";
  if (isInDebugMode) extraText = " not found";
  String translation = localizedValues?[key] ?? key! + extraText;
  if (arguments == null || arguments.length == 0) {
    return translation;
  }
  arguments.forEach((argumentKey, value) {
    if (value == null) {
      LoggerDefault.log.wtf('Value for "$argumentKey" is null in call of translate(\'$key\')');
      value = '';
    }
    translation = translation.replaceAll("\$$argumentKey", value);
  });
  return translation;
}