reader property

dynamic reader
final

A reference function use to parse data from SQLite to Dart object.

For example: A field map object is not supported by SQLite however we can store this value in the form of JSON encoded thus we can use json.encode as reader.

@Column(type: SQLiteDataType.text, reader: json.encode)
late final Map<String,int> dictionary;

For complex conversion, please provide your own function or implement a method 'toSQL' where it return SQLite Data Type.

class A {
  // normal creation
  A(this.a);

  // use by RowCreator to create this class based on value from SQLite database.
  A.fromSQLite(int val): a = val;

  final int a;

  // Return encode data that represent this class
  int toSQLite() => a;
}

@Table('sample')
mixin B {
  @Column(type: SQLiteDataType.integer)
  late final A a;
}

Implementation

final dynamic reader;