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 = {
    'color': strColor,
  };

  // Null & false values on fields can break the API call.
  if (bold) {
    json['bold'] = bold;
  }
  if (italic) {
    json['italic'] = italic;
  }
  if (strikethrough) {
    json['strikethrough'] = strikethrough;
  }
  if (underline) {
    json['underline'] = underline;
  }
  if (code) {
    json['code'] = code;
  }

  return json;
}