drift
Drift is a reactive library to store relational data in Dart and Flutter applications.
2.34.3
1.1M downloads/mo
#327 most downloaded on pub.dev
simolus3/drift
What this package is like to depend on
Last release 27 days ago
27 Jul 2026
Ships on a steady schedule
a new release about every 4 weeks
Nearly every release is documented
notes for 71 of 75 stable releases
Nothing withdrawn
no release was ever pulled
5 years old
75 releases · first in 2021
12 releases in the last 12 months
see the full history below
Release timeline
75 releases · Oct 2021 to Jul 2026Releases
latest 60 of 75-
2.34.327 Jul 2026Release notes
Open source →- Web: Use navigator locks around OPFS access to avoid file locking issues.
Release notes
Open source →- Web: Use navigator locks around OPFS access to avoid file locking issues.
-
2.34.214 Jul 2026Release notes
Open source →- Web: Flush IndexedDB writes after statements, making writes more reliable.
sqlite3.wasmfiles are now attached to drift releases directly, making it easier to download compatible workers and WebAssembly files.Release notes
Open source →- Web: Flush IndexedDB writes after statements, making writes more reliable.
-
2.34.106 Jul 2026Release notes
Open source →drift 2.34.1
- Fix reads queued in a
MultiExecutorconnection pool being resumed in the wrong zone once an executor became available. Because Drift's cancellation tokens are zone-scoped, this could cause queries to be cancelled or observed in the wrong zone (#3824).
drift_dev 2.34.2
- Drift files: Support for dart placeholder in
updatestatements to reference companions. - Allow circular references between tables (#3780).
sqlparser 0.44.6
- Fix join analysis to properly treat the left side of a
RIGHTorFULLjoin as nullable (#3812). - Fix
CaseInsensitiveMap.containsKeyto be case-insensitive.
Release notes
Open source →- Fix reads queued in a
MultiExecutorconnection pool being resumed in the wrong zone once an executor became available. Because Drift's cancellation tokens are zone-scoped, this could cause queries to be cancelled or observed in the wrong zone (#3824).
- Fix reads queued in a
-
2.34.010 Jun 2026Release notes
Open source →- Use
BEGIN IMMEDIATEto start transactions. - Make
TableInfo's==andhashCodetake into account the database its attached to.
- Use
-
2.33.003 May 2026Release notes
Open source →- Add
lengthextension for blob expressions. - Add
SqlDialect.duckdbfor use with thedrift_duckdbpackage.
- Add
-
2.32.122 Mar 2026 -
2.32.028 Feb 2026Release notes
Open source →- Potentially breaking change Migrate to version 3.x of the
sqlite3package. To upgrade:- For the web, update
sqlite3.wasmfrom a 3.x release. - If you've previously used
sqlcipher_flutter_libs, see this for encryption support and note that SQLite3MultipleCiphers requires additional pragmas to be compatible with SQLCipher databases.
- For the web, update
serializableConnection(),json1andTableMigrationare no longer marked as experimental.- Improve performance of mapping large result sets through joined select statements.
- Potentially breaking change Migrate to version 3.x of the
-
2.31.003 Feb 2026Release notes
Open source →- In step-by-step migrations, automatically throw an error if a database
downgrade is attempted. This has always been unsupported, but could lead to
the database silently having a wrong
user_version.
- In step-by-step migrations, automatically throw an error if a database
downgrade is attempted. This has always been unsupported, but could lead to
the database silently having a wrong
-
2.30.112 Jan 2026Release notes
Open source →- Web: Fix databases being moved from IndexedDB to OPFS even if
moveExistingIndexedDbToOpfsis disabled.
- Web: Fix databases being moved from IndexedDB to OPFS even if
-
2.30.005 Dec 2025Release notes
Open source →- Add
rightOuterJoinandfullOuterJoin. - Wasm: Add the
WasmProbeResult.moveFromIndexedDBToOpfs()method and themoveExistingIndexedDbToOpfsparameter onWasmDatabase.open. They can be used to move an existing database stored in IndexedDB to OPFS.
- Add
-
2.29.018 Oct 2025Release notes
Open source →- Allow specifying ordering for columns in
@TableIndexannotation. - Add
DelegatedDatabase.externalExecutor, allowing transactions started externally to be used with drift. - Add
Batch.insertFromSelectto insert rows from a select statement in a batch. - Devtools extension: Support exporting databases.
- Allow specifying ordering for columns in
-
2.28.221 Sep 2025Release notes
Open source →- Legacy wasm database: Fix cast issue when compiling with
dart2wasm. NativeDatabase.createBackground: Allow enablingisolateDebugLog.
- Legacy wasm database: Fix cast issue when compiling with
-
2.28.129 Jul 2025Release notes
Open source →- Add
escapeCharargument tolike()to generate anESCAPEclause. - Native database: Cache prepared statements by default.
- Add
-
2.28.013 Jul 2025Release notes
Open source →- Query delegates: Support nested transactions in
SupportedTransactionDelegate. - Add
WasmProbeResult.exportDatabaseto export an existing web database as aUint8List. - Fix drift server isolates leaking when their only client isolate exits without closing the database.
- Query delegates: Support nested transactions in
-
2.27.014 Jun 2025Release notes
Open source →- Allow passing
sqlite3callback toNativeDatabaseto customize how SQLite bindings are obtained.
- Allow passing
-
2.26.103 May 2025Release notes
Open source →- Add
isNotNull()column filter for the manager APIs. - Add optional
orderByparameter to more aggregate function extension.
- Add
-
2.26.008 Mar 2025 -
2.25.114 Feb 2025Release notes
Open source →- Fix shared worker feature detection when the main app is compiled with
dart2wasm.
- Fix shared worker feature detection when the main app is compiled with
-
2.25.008 Feb 2025Release notes
Open source →- Report
SqliteExceptions occurring on workers asSqliteExceptioninstances. Previously, they were sent as strings only. - Fix
LazyDatabasebeing closed without ever being used potentially leaking resources.
- Report
-
2.24.021 Jan 2025Release notes
Open source →- Add
TypeConverter.jsonbto directly store values in the JSONB format used by SQLite. - Deprecate
TypeConverter.jsonutility in favor ofTypeConverter.json2. The new method avoids encoding values twice when mapping drift row classes to JSON. - Add
runWithInterceptormethod to databases to only apply interceptors in a restricted block.
- Add
-
2.23.105 Jan 2025Release notes
Open source →- Fix
TableStatements.insertAllto only apply a database-specific pragma for SQLite databases. - Don't attempt to roll-back transactions that failed to begin.
- Fix unhandled exception when cancelling transactions.
- Fix deadlock when drift databases are used in a
fake_asyncZone and then closed outside that zone.
- Fix
-
2.23.027 Dec 2024Release notes
Open source →- Allow building compound select statements in Dart.
- Support
NULLS FIRSTandNULLS LASTin manager API.
-
2.22.130 Nov 2024Release notes
Open source →- Fix generated SQL for
insertFromSelectstatements with upserts. - Fix
alterTablefor databases wherelegacy_alter_tableis not writable. - Allow
package:drift/web.dartto be imported into Dart apps compiled with dart2wasm.
- Fix generated SQL for
-
2.22.028 Nov 2024Release notes
Open source →- Add
sqliteAny()method to tables to declareANYcolumns. - Add missing parentheses around adjacent expressions of the same precedence.
- Fix creating tables that are both
STRICTandWITHOUT ROWID. - WASM: Report worker failures to make them easier to diagnose.
- Allow closing stream queries synchronously, making drift easier to use in widget tests.
- Add
-
2.21.014 Oct 2024Release notes
Open source →- To infer whether serialization is required for inter-isolate communication, drift now sends a test message instead serializing by default.
- The manager API now ignores references whose target column is a foreign key itself.
- The DevTools extension can now clear drift databases.
View.fromis now declared to return aJoinedSelectStatement, the type it returns at runtime.
-
2.20.329 Sep 2024Nothing published for this version
-
2.20.210 Sep 2024 -
2.20.108 Sep 2024Release notes
Open source →- Migrate legacy
package:drift/web.dartto the new JS interop SDK libraries. For backwards compatibility, thechannel()extension on theMessagePortclass indart:htmlhas been kept. Oncedart:htmlis removed from the Dart SDK, that extension will have to be removed from drift as well. - Fix cast errors in the protocol for remote workers when compiling with
dart2wasm. - Introduce a faster protocol for communicating with workers. This protocol is
enabled automatically after upgrading
drift_worker.js.
- Migrate legacy
-
2.20.016 Aug 2024Release notes
Open source →- Improve manager API to be able to resolve references when running queries.
- Add
readPoolparameter toNativeDatabase. It will spawn an additional pool of isolates used to serve multiple reads in parallel, which can improve performance in some specific workloads. - Add
TableIndex.sql, allowing database indexes to be defined in SQL without using drift files. - Add
DataClassName.implementing, which can be used to make drift-generated row classes implement existing interfaces. - Mark legacy
package:drift/web.dartas deprecated. Users should migrate topackage:drift/wasm.dart.
-
2.19.213 Aug 2024 -
2.19.112 Jul 2024Nothing published for this version
-
2.19.1+118 Jul 2024Release notes
Open source →- Fix
exclusivelybreaking the database connection on the web. Please note that this requires an updateddrift_worker.jsto fix.
- Fix
-
2.19.011 Jul 2024Release notes
Open source →- Add
exclusivelymethod to database classes, allowing a block to temporarily take exclusive control over a database connection without starting a transaction. - Add the
enableMigrationsparameter toWasmDatabaseto control whether drift migrations are enabled on that database. - Add
initiallyDeferredoption toreferences()column builder for foreign key constraints. - Add
dropColumnmethod toMigrator. - Add
selectExpressionsmethod to build select statements without aFROMclause. - Fix encoding
BigIntarguments in batched statements sent to web workers. Note that the fix also requires the latestdrift_worker.jsto be effective. - Both
transactionandexclusivelywill wait for the transaction or the exclusive lock to be set up before invoking their callback now. - Fix stream queries possibly cancelling a migration if they are the first method on the database.
- Add
-
2.18.004 May 2024Release notes
Open source →- Adds a new interface for writing most simple statements without manually creating
select statements and expressions.
For a detailed description, see the documentation website.
This feature requires additional code to be generated - if you prefer using the existing APIs
exclusively, you can use the
generate_manager: falsebuilder option - Add
AggregateFunctionExpressionto write custom aggregate function invocations in the Dart query builder. - The
json_group_arrayandjsonb_group_arrayfunctions now contain anorderByandfilterparameter.
- Adds a new interface for writing most simple statements without manually creating
select statements and expressions.
For a detailed description, see the documentation website.
This feature requires additional code to be generated - if you prefer using the existing APIs
exclusively, you can use the
-
2.17.020 Apr 2024Release notes
Open source →- Adds
companionentry toDataClassNameto override the name of the generated companion class. - Add the
TypeConverter.extensionTypefactory to create type converters for extension types. - Fix invalid SQL syntax being generated for
BLOBliterals on postgres.
- Adds
-
2.16.024 Feb 2024Release notes
Open source →- When a migration throws, the database will now block subsequent operations instead of potentially allowing them to operate on a database in an inconsistent state.
- Statements built through the Dart query builder will now run in the context
active while they are running, instead of the context active at the time they
were created. For instance, creating an
UpdateStatementwithdatabase.updateoutside of a transaction and then callingUpdateStatement.writeinside of a transaction will now perform the update inside of the transaction, instead of causing a deadlock. - Improve stack traces for errors happening on drift isolates (which includes
usages of
NativeDatabase.createInBackground). - Don't cache
EXPLAINstatements, avoiding schema locks. - Deprecate
Value.ofNullablein favor ofValue.absentIfNull, which is more explicit about its behavior and allows nullable types too. - Migrate
WasmDatabasetodart:js_interopandpackage:web.
-
2.15.017 Jan 2024Release notes
Open source →- Methods in the query builder API now respect custom types.
- Support
DialectAwareSqlType, custom types that depend on the dialect of the active database connection. This can be used to use native types not supported by drift (like UUIDs) on databases that support it while falling back to a text type on sqlite3. - Close wasm databases hosted in workers after the last client disconnects.
- Add
enableMigrationsparameter toNativeDatabasewhich can be used to optionally disable database migrations when opening databases. - Support
jsonbfunctions in the Dart query builder.
-
2.14.112 Dec 2023 -
2.14.004 Dec 2023Release notes
Open source →- Add the
QueryInterceptorAPI to easily monitor or transform all database calls made by drift. - Add the
count()extension on tables to easily count rows in tables or views.
- Add the
-
2.13.226 Nov 2023Release notes
Open source →- Fix a race condition causing query streams to not emit new data around some transaction setups.
-
2.13.105 Nov 2023 -
2.13.020 Oct 2023Release notes
Open source →- Add APIs to setup Wasm databases with custom drift workers.
- Add support for custom types, which are useful when extending drift to support other database engines.
- Drift now provides a DevTools extension embedding the drift inspector written by Koen Van Looveren.
- Add
Expression.andandExpression.orto create disjunctions and conjunctions of sub-predicates. - Step-by-step migrations now save the intermediate schema version after each step.
-
2.12.127 Sep 2023Release notes
Open source →- Fix
readWithConverterthrowing an exception for null values in non- nullable columns.
- Fix
-
2.12.024 Sep 2023Release notes
Open source →- Add support for table-valued functions in the Dart query builder.
- Add the
@TableIndexannotation for table classes to add an index to the table. - Support
json_eachandjson_tree. - Add the
TypeConverter.jsonmethod to define type converters storing JSON values more easily. - Add
TypedResult.readWithConverterto read a column with a type converter from a join result row.
-
2.11.127 Aug 2023Release notes
Open source →- Allow using
.read()for a column added to a join from the table, fixing a regression in drift 2.11.0. - Make step-by-step migrations easier to customize with
Migrator.runMigrationSteps.
- Allow using
-
2.11.011 Aug 2023Release notes
Open source →- Add support for subqueries in the Dart query builder.
- Add
isInExpandisNotInExpto constructIS INexpressions with arbitrary expressions. - Add the
substrextension onExpression<String>to call the sqlite3 function from the Dart API. - Add
isolateSetuptoNativeDatabase.createInBackground()to override native libraries or perform other database-unrelated setup work. - Add
WasmDatabase.probe(), a method probing for available implementations and existing databases on the web without opening one directly.
-
2.10.013 Jul 2023Release notes
Open source →- Adds the
schema stepscommand todrift_dev. It generates an API making it easier to write safe schema migrations (docs). - Fix drift WASM not being unusable after a previous database implementation becomes unavailable in the browser.
- Adds the
-
2.9.018 Jun 2023Release notes
Open source →- Forbid
schemaVersionreturning0, as this causes issues in the migrator. - Drift web support is now stable! By using a
WasmDatabase.openfactory as described in https://drift.simonbinder.eu/web/, you can run a drift database in modern browsers!
- Forbid
-
2.8.208 Jun 2023Release notes
Open source →- Fix prepared statements leaking when the statement cache is disabled.
- Disable prepared statement caching by default.
-
2.8.101 Jun 2023Release notes
Open source →- Performance improvement: Cache and re-use prepared statements - thanks to @davidmartos96
- Fix a deadlock after rolling back a transaction in a remote isolate.
- Remove unintended log messages when using
connectToDriftWorker.
-
2.8.010 May 2023Release notes
Open source →- Don't keep databases in an unusable state if the
setupcallback throws an exception. Instead, drift will retry the next time the database is used. - Allow targeting partial indices in
DoUpdate(#2394) - Fix deadlocks when
computeWithDatabaseis called inside atransaction().
- Don't keep databases in an unusable state if the
-
2.7.010 Apr 2023Release notes
Open source →- Add support for
CASEexpressions without a base in the Dart API with theCaseWhenExpressionclass. - Add the new
package:drift/web/workers.dartlibrary which makes it easier to create web workers for drift.
- Add support for
-
2.6.020 Mar 2023Release notes
Open source →- Add
insertReturningOrNullfor potentially empty inserts. - Add
insertFromSelecttoInsertStatementto runINSERT INTO SELECTstatements. - Add
rowidparameter to companions for tables with rowids that don't have a visible alias for the rowid. - After opening a database with a higher schema version than the current one set in the database class, the schema version in the database will now be downgraded.
- When using a drift isolate in the same engine group, errors on the remote end are
reported directly instead of wrapping them in a
DriftRemoteException. - Added support for
DO NOTHINGduring upsert operations with constraint violations
- Add
-
2.5.029 Jan 2023Release notes
Open source →- Add
isExp,isValue,isNotExpandisNotValuemethods toExpressionto generate theISoperator in SQL. - Add
all()extension on tables and views to quickly query all rows. - Add
serializableConnection()andcomputeWithDatabase()as extensions on databases. The methods allow sharing any drift database between isolates, regardless of how the database has been set up. - The
DatabaseConnectionclass now implementsQueryExecutor, meaning that you no longer need a special.connect()constructor to use it.
- Add
-
2.4.203 Jan 2023Release notes
Open source →- Fix an exception when a client disconnects from a drift remote server while processing a pending table update.
-
2.4.131 Dec 2022 -
2.4.029 Dec 2022Release notes
Open source →- Add
textEnumcolumn builder andEnumNameConverterto be able to store enum values as string. - Add
updatesparameter toBatch.customStatement- it can be used to specify which tables are affected by the custom statement. - For
STRICTtables in drift files declaring aANYcolumn, drift will now generate a mapping to the newDriftAnytype. - Add
likeExpto generateLIKEexpression with any comparison expression. - Fix
UNIQUEkeys declared in drift files being written twice. - Fix
customConstraintsnot appearing in dumped database schema files. - Lazily load columns in
TypedResult.read, increasing performance for joins with lots of tables or columns. - Work-around an issue causing complex migrations via
Migrator.alterTablenot to work if a view referenced the altered table.
- Add
-
2.3.027 Nov 2022Release notes
Open source →- Add the
JsonTypeConverter2mixin. It behaves similar to the existing json type converters, but can use a different SQL and JSON type. - Add
isInValuesandisNotInValuesmethods to columns with type converters. They can be used to compare the column against a list of Dart expressions that will be mapped through a type converter. - Add
TableStatements.insertAllto atomically insert multiple rows. - Add
singleClientModetoremote()andDriftIsolateconnections to make the common case with one client more efficient. - Fix a concurrency issue around transactions.
- Add
NativeDatabase.createInBackgroundas a drop-in replacement forNativeDatabase. It creates a drift isolate behind the scenes, avoiding all of the boilerplate usually involved with drift isolates. - Experimental: Add a modular generation mode in which drift will generate multiple smaller files instead of one very large one with all tables and generated queries.
- Add the
-
2.2.006 Oct 2022Release notes
Open source →- Always escape column names, avoiding the costs of using a regular expression to check whether they need to be escaped.
- Add extensions for binary methods on integer expressions:
operator ~,bitwiseAndandbitwiseOr.
-
2.1.029 Aug 2022Release notes
Open source →- Improve stack traces when using
watchSingle()with a stream emitting a non- singleton list at some point. - Add
OrderingTerm.nullsto control theNULLS FIRSTorNULLS LASTclause in Dart.
- Improve stack traces when using