toJsonForProtocol method

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

Returns a JSON structure of the model, optimized for Protocol communication.

Implementation

@override
Map<String, dynamic> toJsonForProtocol() {
  return {
    '__className__': 'Project',
    if (id != null) 'id': id,
    'createdAt': createdAt.toJson(),
    'updatedAt': updatedAt.toJson(),
    if (archivedAt != null) 'archivedAt': archivedAt?.toJson(),
    'cloudProjectId': cloudProjectId,
    'ownerId': ownerId.toJson(),
    if (owner != null) 'owner': owner?.toJsonForProtocol(),
    if (roles != null)
      'roles': roles?.toJson(valueToJson: (v) => v.toJsonForProtocol()),
    if (capsules != null)
      'capsules': capsules?.toJson(valueToJson: (v) => v.toJsonForProtocol()),
  };
}