build<I extends Info, E extends Entry<I>> static method

Future<SqliteAdapter<I, E>> build<I extends Info, E extends Entry<I>>(
  1. SqliteBuilder<I, E> builder,
  2. File file, {
  3. bool? logStatements,
  4. DatabaseSetup? setup,
  5. bool? cachePreparedStatements,
  6. FutureOr<void> isolateSetup()?,
})

Builds SqliteBackgroundFileAdapter.

  • builder: Database builder
  • file: The File that store the Sqlite database
  • logStatements: Generated sql statements will be printed before executing
  • setup: Function that can be used to perform a setup just after the database is opened
  • cachePreparedStatements: controls whether drift will cache prepared statement objects
  • isolateSetup: function that can perform setup work on the isolate before opening the database.

Implementation

static Future<SqliteAdapter<I, E>> build<I extends Info, E extends Entry<I>>(
    SqliteBuilder<I, E> builder, File file,
    {bool? logStatements,
    DatabaseSetup? setup,
    bool? cachePreparedStatements,
    FutureOr<void> Function()? isolateSetup}) {
  return Future.value(SqliteBackgroundFileAdapter._(
      builder(NativeDatabase.createInBackground(file,
          logStatements: logStatements ?? false,
          setup: setup,
          cachePreparedStatements: cachePreparedStatements ?? false)),
      file));
}