Column class

Associates a field with a database column.

Fields without this or relationship annotations are ignored by the ORM unless they are basic primitive types.

Example:

@Column(name: 'user_name', unique: true, nullable: false)
late String name;
Annotations
  • @Target.new({TargetKind.field})

Constructors

Column({String? name, String? type, bool unique = false, bool nullable = true})
const

Properties

hashCode int
The hash code for this object.
no setterinherited
name String?
Optional override for the column name. Defaults to snake_case of field name.
final
nullable bool
Whether the column is nullable.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type String?
Optional override for the database type (e.g., 'TEXT', 'VARCHAR(255)').
final
unique bool
Whether the column is unique.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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