run static method

Future<void> run(
  1. List<String> args,
  2. SendPort port,
  3. GeneratedDatabase database(
    1. QueryExecutor
    )
)

Creates a SchemaExporter with the database, parses the single-argument args list as a dialect name, calls collectOnCreateStatements and sends the resulting list over the port.

This sequence is used by the drift_dev schema export command, which prints CREATE statements making up a drift database analyzed from source. For this to work, it emulates a drift build and then creates a Dart program calling this method.

This method is thus internal to that utility and likely not useful outside of that.

Implementation

static Future<void> run(
  List<String> args,
  SendPort port,
  GeneratedDatabase Function(QueryExecutor) database,
) async {
  final export = SchemaExporter(database);
  final statements = await export
      .collectOnCreateStatements(SqlDialect.values.byName(args.single));
  port.send(statements);
}