toJson method

  1. @override
Map<String, dynamic> toJson()
override

Serializes a Metadata to its RWPM JSON representation.

Implementation

@override
Map<String, dynamic> toJson() => Map.from(otherMetadata)
  ..putOpt("identifier", identifier)
  ..putOpt("@type", type)
  ..putJSONableIfNotEmpty("title", localizedTitle)
  ..putJSONableIfNotEmpty("subtitle", localizedSubtitle)
  ..putOpt("modified", modified?.toIso8601String())
  ..putOpt("published", published?.toIso8601String())
  ..putIterableIfNotEmpty("language", languages)
  ..putJSONableIfNotEmpty("sortAs", localizedSortAs)
  ..putIterableIfNotEmpty("subject", subjects)
  ..putIterableIfNotEmpty("author", authors)
  ..putIterableIfNotEmpty("translator", translators)
  ..putIterableIfNotEmpty("editor", editors)
  ..putIterableIfNotEmpty("artist", artists)
  ..putIterableIfNotEmpty("illustrator", illustrators)
  ..putIterableIfNotEmpty("letterer", letterers)
  ..putIterableIfNotEmpty("penciler", pencilers)
  ..putIterableIfNotEmpty("colorist", colorists)
  ..putIterableIfNotEmpty("inker", inkers)
  ..putIterableIfNotEmpty("narrator", narrators)
  ..putIterableIfNotEmpty("contributor", contributors)
  ..putIterableIfNotEmpty("publisher", publishers)
  ..putIterableIfNotEmpty("imprint", imprints)
  ..putOpt("readingProgression", readingProgression.value)
  ..putOpt("description", description)
  ..putOpt("duration", duration)
  ..putOpt("numberOfPages", numberOfPages)
  ..putMapIfNotEmpty("belongsTo", belongsTo);