Skip to content
pubscout

drift_sqlite_async

0.3.1, released 6 months ago by powersync.com

Use Drift with a sqlite_async database in the same application.

WASM-ready
$ flutter pub add drift_sqlite_async
Source repository

What it does

Allows using Drift and sqlite_async together on the same database. Synchronizes table updates between both APIs and supports transactions, migrations, and concurrent reads.

AI-written summary of version 0.3.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want to use Drift ORM features alongside sqlite_async database capabilities.
  • You need concurrent read queries while writes are happening in SQLite.

Skip it when

  • You do not need sqlite_async and can use standard Drift database connections directly.
  • Your project relies on read-only transactions in Drift, which are not currently supported.

Strengths

  • Seamless integration between Drift and sqlite_async APIs.
  • Automatic propagation of table updates and watching queries across both systems.
  • Supports transactions, nested transactions, and Drift migrations.

Weaknesses

  • Read-only transactions are not currently supported in Drift.
  • Web support requires manual placement of sqlite3 WASM and web worker files.
  • Potential for duplicated update events.

Setup

Kind
Pure Dart
Effort
Medium
Code generation
No
Direct dependencies
3

Requires setting up SqliteAsyncDriftConnection and configuring web worker/WASM assets if targeting the web platform.

@DriftDatabase(tables: [TodoItems])
class AppDatabase extends _$AppDatabase {
  AppDatabase(SqliteConnection db) : super(SqliteAsyncDriftConnection(db));

  @override
  int get schemaVersion => 1;
}

Future<void> main() async {
  final db = SqliteDatabase(path: 'example.db');
  final appdb = AppDatabase(db);
}

Alternatives

Packages that do the same job and could replace drift_sqlite_async.

  • sqflite

    If you prefer the standard SQLite plugin for Flutter without advanced async connection pooling.

Works with

Packages commonly used together with drift_sqlite_async: ones it builds on, ones built on it, and its own family.