toJson method
Implementation
@override
Map<String, dynamic> toJson() {
final json = <String, dynamic>{
'type': 'image',
'mimeType': mimeType,
};
// 2025 spec uses 'data' for base64, but maintain 'url' for compatibility
if (data != null) {
json['data'] = data!;
} else if (url != null) {
json['url'] = url!;
}
if (annotations != null) json['annotations'] = annotations!;
return json;
}