register<T extends Serializable> method

Future<void> register<T extends Serializable>(
  1. T factory()
)

Implementation

Future<void> register<T extends Serializable>(T Function() factory) async {
  if (!_isOpen) throw const FlutterSqliteException('Database not open');

  final type = T;
  if (_tables.containsKey(type)) return;

  _factories[type] = factory;
  final instance = factory();
  final tableInfo = instance.getTableInfo();
  _tables[type] = tableInfo;

  await _impl!.execute(_createTableSql(tableInfo));
}