toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  return {
    'id': id,
    'type': type,
    if (role != null) 'role': role,
    if (content != null) 'content': content,
  };
}