writer property

dynamic writer
final

A reference function use to convert unsupported database to SQLite Data Type.

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.decode as writer.

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

For complex conversion, please provide your own function or implement a constructor 'fromSQL' where it accept a single 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 writer;