toJson method

Map<String, dynamic> toJson()

Convert this to a json representation valid for the Notion API.

Implementation

Map<String, dynamic> toJson() {
  Map<String, dynamic> json = {'type': this.strType};

  // Only database and page types contain an id.
  if (this.type == ParentType.Database || this.type == ParentType.Page) {
    json[strType] = this.id;
  }

  return json;
}