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.isNotEmpty) {
    return _titleRecords[0].text;
  } else {
    return null;
  }
}
set title (dynamic title)

Implementation

set title(var title) {
  var language = 'en';
  String 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)] = TextRecord(text: text);
  } else {
    addTitle(text, language: language);
  }
}