Table class Null safety

Subclasses represent a table in a database generated by drift.

Inheritance

Constructors

Table()
Defines a table to be used with drift.
const

Properties

customConstraints List<String>
Custom table constraints that should be added to the table. [...]
read-only
dontWriteConstraints bool
Drift will write some table constraints automatically, for instance when you override primaryKey. You can turn this behavior off if you want to. This is intended to be used by generated code only.
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
primaryKey Set<Column>?
Override this to specify custom primary keys: [...]
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
tableName String?
The sql table name to be used. By default, drift will use the snake_case representation of your class name as the sql table name. For instance, a Table class named LocalSettings will be called local_settings by default. You can change that behavior by overriding this method to use a custom name. Please note that you must directly return a string literal by using a getter. For instance @override String get tableName => 'my_table'; is valid, whereas @override final String tableName = 'my_table'; or @override String get tableName => createMyTableName(); is not.
withoutRowId bool
Whether to append a WITHOUT ROWID clause in the CREATE TABLE statement. This is intended to be used by generated code only.
read-only

Methods

blob() ColumnBuilder<Uint8List>
Use this as the body of a getter to declare a column that holds arbitrary data blobs, stored as an Uint8List. Example: [...]
boolean() ColumnBuilder<bool>
Use this as the body of a getter to declare a column that holds bools. Example (inside the body of a table class): [...]
dateTime() ColumnBuilder<DateTime>
Use this as the body of a getter to declare a column that holds date and time. Note that DateTime values are stored on a second-accuracy. Example (inside the body of a table class): [...]
integer() ColumnBuilder<int>
Use this as the body of a getter to declare a column that holds integers. Example (inside the body of a table class): [...]
intEnum<T>() ColumnBuilder<int>
Creates a column to store an enum class T. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
real() ColumnBuilder<double>
Use this as the body of a getter to declare a column that holds floating point numbers. Example [...]
text() ColumnBuilder<String>
Use this as the body of a getter to declare a column that holds strings. Example (inside the body of a table class): [...]
toString() String
A string representation of this object. [...]
inherited

Operators

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