displayText method
The display value as one line of text.
A string is returned as is; a { lang: text } map (a translatable term
name) gives the language entry, or the first entry when the language
is not set or not present; any other value is its JSON-ish string form.
null when the target is missing.
Implementation
String? displayText({String? language}) {
final value = display;
if (value == null) return null;
if (value is String) return value;
if (value is Map) {
if (value.isEmpty) return null;
if (language != null && value[language] != null) {
return '${value[language]}';
}
return '${value.values.first}';
}
return '$value';
}