toJson method

  1. @override
Map<String, dynamic> toJson()
override

Implementation

@override
Map<String, dynamic> toJson() {
  final String attachmentId = attachment?.id ?? imageAttachmentId ?? '';

  return {
    ...super.toJson(),
    'rotation': rotation,
    if (description != null) 'description': description,
    if (fileName != null) 'fileName': fileName,
    if (contentType != null) 'contentType': contentType,
    if (attachmentId.isNotEmpty) 'imageAttachmentId': attachmentId,
    if (note != null) 'note': note,
    if (isSignature != null) 'isSignature': isSignature, // Added to toJson
  };
}