toJson method

Map<String, dynamic> toJson()

Serializes FormData to json

Implementation

Map<String, dynamic> toJson() {
  return {
    'id': id,
    if (name != null) 'name': name,
    if (title != null) 'title': title,
    if (description != null) 'description': description,
    if (components != null)
      'components': components!.map((e) => e.toJson()).toList(),
    if (fields != null)
      'fields': fields!.map((field) => field.toJson()).toList(),
    '_links': links.toJson(),
    if (attachmentActions.isNotEmpty)
      'attachmentActions':
          attachmentActions.values.map((e) => e.toJson()).toList(),
    if (properties != null) 'properties': properties!.toJson(),
    'fieldProperties': Map.fromEntries(
      fieldProperties.map((e) => MapEntry(e.fieldId, e.toJson())),
    ),
  };
}