collectOnCreateStatements method

Future<List<String>> collectOnCreateStatements([
  1. SqlDialect dialect = SqlDialect.sqlite
])

Opens the database and runs the onCreate migration callback, collecting all statements that were executed in the process.

Implementation

Future<List<String>> collectOnCreateStatements(
    [SqlDialect dialect = SqlDialect.sqlite]) async {
  final collector = CollectCreateStatements(dialect);
  final db = _database(collector);
  await db.runConnectionZoned(BeforeOpenRunner(db, collector), () async {
    // ignore: invalid_use_of_protected_member, invalid_use_of_visible_for_testing_member
    final migrator = db.createMigrator();
    await migrator.createAll();
  });

  return collector.statements;
}