insert<T extends Serializable> method
Future<void>
insert<
T extends Serializable>( - T model
)
Implementation
Future<void> insert<T extends Serializable>(T model) async {
if (!_isOpen) throw const FlutterSqliteException('Database not open');
final type = T;
final tableInfo = _tables[type];
if (tableInfo == null) {
throw FlutterSqliteException('Table not registered for type $type');
}
final sql = _buildInsertSql(tableInfo);
final values = model.toMap();
final orderedValues = <dynamic>[];
for (final column in tableInfo.columns) {
if (column.autoIncrement) continue;
orderedValues.add(values[column.dartName]);
}
await _impl!.execute(sql, orderedValues);
}