withDefault method
The column will use this expression when a row is inserted and no value has been specified.
Note: Unlike most other methods used to declare tables, the parameter
e
which denotes the default expression doesn't have to be a Dart
constant.
Particularly, you can use operators like those defined in
BooleanExpressionOperators to form expressions here.
If you need a column that just stores a static default value, you could use this method with a Constant:
IntColumn get level => int().withDefault(const Constant(1))();
See also:
- Constant, which can be used to model literals that appear in CREATE TABLE statements.
- currentDate and currentDateAndTime, which are useful expressions to store the current date/time as a default value.
Implementation
ColumnBuilder<T> withDefault(Expression<T> e) => _isGenerated();