toJson method
Converts the parameter to a JSON-serializable map.
Returns a map that can be serialized to JSON for the API request.
Implementation
@override
Map<String, dynamic> toJson() {
final json = {
'type': 'document',
'document': {
'link': documentUrl,
},
};
if (filename != null && filename!.isNotEmpty) {
(json['document'] as Map<String, dynamic>)['filename'] = filename;
}
return json;
}