customInsert method Null safety

Future<int> customInsert(
  1. String query,
  2. {List<Variable> variables = const [],
  3. Set<TableInfo<Table, dynamic>>? updates}
)

Executes a custom insert statement and returns the last inserted rowid.

You can tell drift which tables your query is going to affect by using the updates parameter. Query-streams running on any of these tables will then be re-run.

Implementation

Future<int> customInsert(String query,
    {List<Variable> variables = const [], Set<TableInfo>? updates}) {
  return _customWrite(
    query,
    variables,
    updates,
    UpdateKind.insert,
    (executor, sql, vars) {
      return executor.runInsert(sql, vars);
    },
  );
}