insertAll method
Atomically inserts all rows into the table.
Unlike calling Batch.insertAll in a Batch directly, foreign keys are
checked only after all inserts ran. In other words, the order in which
the rows are in doesn't matter if there are foreign keys between them.
Implementation
Future<void> insertAll(
Iterable<Insertable<Row>> rows, {
UpsertClause<Row, RS>? onConflict,
}) {
return database.transaction(
options: const TransactionOptions(deferForeignKeys: true),
() async {
await database.batch((b) {
b.insertAll(resultSet, rows, onConflict: onConflict);
});
},
);
}