FieldDefinition class

Metadata for a single model field/column.

Constructors

FieldDefinition({required String name, required String columnName, required String dartType, required String resolvedType, bool isPrimaryKey = false, required bool isNullable, bool isUnique = false, bool isIndexed = false, bool autoIncrement = false, String? columnType, String? defaultValueSql, String? codecType, Object? enumValues, Map<String, FieldDriverOverride> driverOverrides = const {}})
const

Properties

autoIncrement bool
Whether this field auto-increments.
final
codecType String?
Codec type for value transformations.
final
columnName String
The database column name.
final
columnType String?
SQL column type (e.g., 'VARCHAR(255)', 'INTEGER').
final
dartType String
The Dart type as a string (e.g., 'String', 'int?').
final
defaultValueSql String?
SQL default value expression.
final
driverOverrides Map<String, FieldDriverOverride>
Driver-specific overrides for this field.
final
enumValues Object?
Enum values for enum-backed fields (used by enum casts).
final
hashCode int
The hash code for this object.
no setterinherited
isIndexed bool
Whether this field is indexed.
final
isInsertable bool
Returns whether this field should be included in INSERT statements.
no setter
isNullable bool
Whether this field can be null.
final
isPrimaryKey bool
Whether this field is the primary key.
final
isUnique bool
Whether this field has a unique constraint.
final
isUpdatable bool
Returns whether this field should be included in UPDATE statements.
no setter
name String
The Dart property name.
final
resolvedType String
The resolved type after codec transformations.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

codecTypeForDriver(String? driver) String?
Returns the codec type for the specified driver, falling back to the default.
columnTypeForDriver(String? driver) String?
Returns the column type for the specified driver, falling back to the default.
defaultValueSqlForDriver(String? driver) String?
Returns the default value SQL for the specified driver, falling back to the default.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
overrideFor(String? driver) FieldDriverOverride?
Returns the driver-specific override for this field, if any.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited