s static method
Translate the String
Implementation
static String s(String? key) {
/// While developing, return 'null' when appropriate
/// Add key words to a file if not yet found there.
/// assert is removed in production.
assert(() {
if (key == null) {
key = 'null';
} else {
// Remove any leading and trailing spaces.
key = key!.trim();
}
if (_I10n.file != null &&
_useKey &&
(_allValues == null || _allValues!.isEmpty) &&
_localizedValues != null &&
_localizedValues![key] == null) {
_localizedValues!.addAll({key: key});
_I10n.add(key);
}
return true;
}());
/// If not translation, provide the key itself instead.
return _useKey ? key ?? '' : _localizedValues![key] ?? key ?? '';
}