shouldSerializeFieldForDatabase method
Returns true, if this field should be added to the serialization for the
database.
serverCode specifies if it's code on the server or client side.
See also:
Implementation
bool shouldSerializeFieldForDatabase(bool serverCode) {
if (serverCode) {
return shouldPersist;
}
if (shouldPersist && scope == ModelFieldScopeDefinition.all) {
return true;
}
// Client: one-to-many implicit "child" FKs only.
final relation = this.relation;
return shouldPersist &&
scope == ModelFieldScopeDefinition.none &&
relation is ForeignRelationDefinition &&
relation.containerField == null;
}