toJson method

Map<String, dynamic> toJson()

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

Throw an exception if the block have no type (BlockTypes.None).

Implementation

Map<String, dynamic> toJson() {
  if (this.type == BlockTypes.None) {
    throw 'None type for block';
  }

  return {
    'object': strObject,
    'type': strType,
    strType: jsonContent,
  };
}