toJson method
Convert this to a json representation valid for the Notion API.
Implementation
Map<String, dynamic> toJson({bool isResponse: false}) {
Map<String, dynamic> json = {
'parent': this.parent.toJson(),
'properties': this.properties.toJson(),
};
// Add response json fields.
if (isResponse) {
json['object'] = strObject;
json['id'] = id;
json['created_time'] = createdTime;
json['last_edited_time'] = lastEditedTime;
json['archived'] = archived;
}
// Only add children to json if have items.
if (this.children != null && this.children!.isNotEmpty) {
json['children'] = this.children!.toJson();
}
return json;
}