toJson method
Returns a serialized JSON structure of the model which also includes fields used by the database.
Implementation
@override
Map<String, dynamic> toJson() {
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?.toJson(),
if (roles != null) 'roles': roles?.toJson(valueToJson: (v) => v.toJson()),
if (capsules != null)
'capsules': capsules?.toJson(valueToJson: (v) => v.toJson()),
};
}