Column class Null safety

Metadata to describe the behavior of the underlying database column of a persistent property in ManagedObject subclasses.

By default, declaring a property in a table definition will make it a database column and its database column will be derived from the property's type. If the property needs additional directives - like indexing or uniqueness - it should be annotated with an instance of this class.

    class User extends ManagedObject<_User> implements _User {}
    class _User {
      @primaryKey
      int id;

      @Column(indexed: true, unique: true)
      String email;
    }

Constructors

Column({ManagedPropertyType? databaseType, bool primaryKey = false, bool nullable = false, String? defaultValue, bool unique = false, bool indexed = false, bool omitByDefault = false, bool autoincrement = false, List<Validate> validators = const [], bool? useSnakeCaseName, String? name})
Creates an instance of this type.
const

Properties

autoincrement bool
A sequence generator will be used to generate the next value for this column when a row is inserted.
final
databaseType ManagedPropertyType?
The type of the field in the database.
final
defaultValue String?
The default value of the property.
final
hashCode int
The hash code for this object.
read-onlyinherited
isIndexed bool
Whether or not the backing database should generate an index for this property.
final
isNullable bool
Indicates whether or not the property can be null or not.
final
isPrimaryKey bool
When true, indicates that this property is the primary key.
final
isUnique bool
Whether or not the property is unique among all instances.
final
name String?
The name of the underlying column in table.
final
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
shouldOmitByDefault bool
Whether or not fetching an instance of this type should include this property.
final
useSnakeCaseName bool?
Useful to indicate using new snake_case naming convention if name is not set
final
validators List<Validate>
A list of validators to apply to the annotated property.
final

Methods

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

Operators

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