toJson method

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

Serializes a Publication to its RWPM JSON representation.

Implementation

@override
Map<String, dynamic> toJson() {
  Map<String, dynamic> json = <String, dynamic>{}
    ..putIterableIfNotEmpty("@context", context)
    ..putJSONableIfNotEmpty("metadata", metadata)
    ..put("links", links.toJson())
    ..put("readingOrder", readingOrder.toJson())
    ..putIterableIfNotEmpty("resources", resources)
    ..putIterableIfNotEmpty("toc", tableOfContents);
  subcollections.appendToJsonObject(json);
  return json;
}