integer method Null safety

  1. @protected
ColumnBuilder<int> integer()
@protected

Use this as the body of a getter to declare a column that holds integers.

Example (inside the body of a table class):

IntColumn get id => integer().autoIncrement()();

In sqlite3, an integer column stores 64-big integers. This column maps values to an int in Dart, which works well on native platforms. On the web, be aware that ints are doubles internally which means that only integers smaller than 2⁵² can safely be stored. If you need web support and a column that potential stores integers larger than what fits into 52 bits, consider using a int64 column instead. That column stores the same value in a database, but makes drift report the values as a BigInt in Dart.

Implementation

@protected
ColumnBuilder<int> integer() => _isGenerated();