SerializableModelFieldDefinition class
Describes a single field of a ClassDefinition.
Constructors
-
SerializableModelFieldDefinition({required String name, required TypeDefinition type, required ModelFieldScopeDefinition scope, required bool shouldPersist, dynamic defaultModelValue, dynamic defaultPersistValue, RelationDefinition? relation, List<
String> ? documentation, bool isRequired = false, String? columnNameOverride, String? jsonKeyOverride, bool shouldCreateUniqueIndex = false}) - Create a new SerializableModelFieldDefinition.
Properties
- columnName → String
-
Name of the column to be used when referencing the database.
no setter
- defaultModelValue → dynamic
-
final
- defaultPersistValue → dynamic
-
final
-
documentation
→ List<
String> ? -
The documentation of this field, line by line.
final
- hasColumnNameOverride → bool
-
Whether this field has a column name override.
no setter
- hasDefaults → bool
-
returns true if one of the defaults its not null
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasJsonKeyOverride → bool
-
no setter
- hasOnlyDatabaseDefaults → bool
-
returns true if only has database default
no setter
-
indexes
↔ List<
SerializableModelIndexDefinition> -
Indexes that this field is part of.
getter/setter pair
- isRequired → bool
-
Whether this nullable field should be required in constructor parameters.
When true, nullable fields will be marked as required named parameters.
final
- isSymbolicRelation → bool
-
Returns true, if this field has a relation pointer to/from another field
with relation type
ForeignRelationDefinition. This means that this field relation does not propagate to the database, but instead is managed by the other field.no setter - jsonKey → String
-
Key to use for JSON serialization/deserialization.
no setter
- name → String
-
The name of the field.
final
- relation ↔ RelationDefinition?
-
If set the field is a relation to another table. The type of the relation
ForeignRelationDefinition,ObjectRelationDefinitionorListRelationDefinitiondetermines where and how the relation is stored.getter/setter pair - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scope → ModelFieldScopeDefinition
-
The scope of the field.
It tells us if the field should only be present
in a certain context.
final
- shouldCreateUniqueIndex → bool
-
Whether this field should have a unique index auto-generated for it.
final
- shouldPersist → bool
-
final
- type ↔ TypeDefinition
-
The type of the field.
getter/setter pair
Methods
-
autoGeneratedUniqueIndexDefinition(
String tableName) → SerializableModelIndexDefinition? -
When shouldCreateUniqueIndex is true, the btree unique index that is
auto-created for this field on
tableName; otherwisenull. - Fields with !persist or scope ModelFieldScopeDefinition.none are hidden from the wire protocol but stored in the database. On the client, implicit one-to-many child keys are hidden.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
shouldIncludeField(
bool serverCode) → bool -
Returns true, if classes should include this field.
serverCodespecifies if it's a code on the server or client side. -
shouldIncludeHiddenFieldInModelClass(
bool serverCode, {bool modelHasTable = true}) → bool - Whether code generation should emit this field on the in-memory model and Implicit copy/fromJson helpers.
-
shouldSerializeField(
bool serverCode) → bool -
Returns true, if this field should be added to the serialization.
serverCodespecifies if it's code on the server or client side. -
shouldSerializeFieldForDatabase(
bool serverCode) → bool -
Returns true, if this field should be added to the serialization for the
database.
serverCodespecifies if it's code on the server or client side. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited