title property
String?
get
title
get the English title; if not existing, get the first title
Implementation
String? get title {
if (_titleLanguages.contains('en')) {
return titles['en'];
} else if (_titleLanguages.length >= 1) {
return _titleRecords[0].text;
} else {
return null;
}
}
set
title
(dynamic title)
Implementation
set title(var title) {
var language = 'en';
var text;
if (title is String) {
text = title;
} else if (title is Map<String, String>) {
var t = title.entries.toList()[0];
language = t.key;
text = t.value;
} else {
throw ArgumentError(
"Title expects String or Map<String,String>, got ${title.runtimeType}");
}
if (_titleLanguages.contains(language)) {
_titleRecords[_titleLanguages.indexOf(language)] =
new TextRecord(text: text);
} else {
addTitle(text, language: language);
}
}