NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
pub.dev, #297 most downloaded on pub.dev
Drift is a reactive library to store relational data in Dart and Flutter applications.
Latest stable
2.35.4
Last release 13 days ago
08 Nov 2026
Ships on a steady schedule
a new release about every 4 weeks
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
5 years old
81 releases · first in 2021
Drag across the ruler to compare, or tap a release to open it.
Fix an empty companion in Batch.update causing an invalid SQL statement.
Batch.update causing an invalid SQL statement.Native: Make select statements faster by not converting each result row to a map and back.
drift 2.35.3:
QueryRow.data and from QueryExecutor.runSelect are now read-only.UpsertClause.drift_dev 2.35.2:
package:build versions 5.x.text) when deriving the Dart getter name (#2100).sqlparser 0.45.1:
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Web: Fix OPFS file systems not supporting nested transactions (a regression introduced in version 2.34.3).
Web: Properly release transactions held by closing tabs.
drift 2.35.1
RETURNING statements not being persisted to IndexedDB (#3864).MultiExecutor (#3867).Breaking change (web): Remove PortToChannel extension on dart:html types. Use WebPortToChannel extension on MessagePort from package:web instead.
match, matchExp, highlight, snippet, bm25 and rank are now available as extension methods on FTS5 tables from package:drift/extensions/fts5.dart (#3843). Thanks to @minhqdao!PortToChannel extension on dart:html types. Use WebPortToChannel extension on MessagePort from package:web instead.@DriftDatabase instead of silently
generating nothing (#3854).Allow using rowid extension on virtual tables, as they usually provide rowids as well.
rowid extension on virtual tables, as they usually provide rowids as well.moor from drift.drift_dev command not completing when spawning a schema isolate fails.Web: Use navigator locks around OPFS access to avoid file locking issues.
Web: Flush IndexedDB writes after statements, making writes more reliable.
sqlite3.wasm files are now attached to drift releases directly, making it easier to download compatible workers and WebAssembly files.
Fix reads queued in a MultiExecutor connection pool being resumed in the wrong zone once an executor became available. Because Drift's cancellation to
MultiExecutor connection 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).update statements to reference companions.RIGHT or FULL join as nullable (#3812).CaseInsensitiveMap.containsKey to be case-insensitive.Use BEGIN IMMEDIATE to start transactions.
driftBEGIN IMMEDIATE to start transactions.TableInfo's == and hashCode take into account the database its attached to.drift_devsetup callback to validateDatabaseSchema in VerifySelf extension.$ in their name.use_sql_table_name_for_accessors build option, naming the table getters on the database class after the table's SQL name instead of the Dart class name.Add length extension for blob expressions.
length extension for blob expressions.SqlDialect.duckdb for use with the drift_duckdb package.DevTools extension: Make error messages selectable.
references() with analyzer 10.2.0 and later.>=10.0.0 <13.0.0.__Potentially breaking change__ Migrate to version 3.x of the sqlite3 package. To upgrade:
sqlite3 package.
To upgrade:
sqlite3.wasm from a 3.x release.sqlcipher_flutter_libs, see this for encryption support and note that SQLite3MultipleCiphers requires additional pragmas to be compatible with SQLCipher databases.serializableConnection(), json1 and TableMigration are no longer marked as experimental.-- import 'tables.drift';
-- deleteById:
DELETE FROM todos WHERE id = :id;
-- allTodos:
SELECT * FROM todos;
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
user_version.sqlparser version 0.43.1DROP, VACUUM, REINDEX, ATTACH, DETACH, SAVEPOINT, RELEASE, ROLLBACK, ANALYZE, PRAGMA and ALTER TABLE statements.SchemaBuffer class to apply ALTER TABLE and DROP statements to CREATE statements.Web: Fix databases being moved from IndexedDB to OPFS even if moveExistingIndexedDbToOpfs is disabled.
moveExistingIndexedDbToOpfs is disabled.make_migrations: Don't generate schema test helpers when --no-test is set.@DriftAccessors as well.ValidationOptions parameter to testWithDataIntegrity.FileSpans, which is convenient for SQL embedded as text in outer structures.Add rightOuterJoin and fullOuterJoin.
rightOuterJoin and fullOuterJoin.WasmProbeResult.moveFromIndexedDBToOpfs() method and the moveExistingIndexedDbToOpfs parameter on WasmDatabase.open. They can be used to move an existing database stored in IndexedDB to OPFS.isolateSetup parameter to DriftNativeOptions to setup isolates spawned to host database connections.Allow specifying ordering for columns in @TableIndex annotation.
@TableIndex annotation.DelegatedDatabase.externalExecutor, allowing transactions started externally to be used with drift.Batch.insertFromSelect to insert rows from a select statement in a batch.known_tables option. It allows defining external tables assumed to be available without including them in the drift-managed schema.--no-test option to disable generating tests.jaspr_content.Legacy wasm database: Fix cast issue when compiling with dart2wasm.
drift version 2.28.2:dart2wasm.NativeDatabase.createBackground: Allow enabling isolateDebugLog.drift_flutter version 0.2.7:isolateDebugLog parameter to DriftNativeOptions to debug internal messages between isolates.drift_dev version 2.28.3:Add escapeChar argument to like() to generate an ESCAPE clause.
escapeChar argument to like() to generate an ESCAPE clause.package:build version 3.Query delegates: Support nested transactions in SupportedTransactionDelegate.
SupportedTransactionDelegate.WasmProbeResult.exportDatabase to export an existing web database as a Uint8List.Allow passing sqlite3 callback to NativeDatabase to customize how SQLite bindings are obtained.
sqlite3 callback to NativeDatabase to customize how SQLite bindings are obtained.generatedAs expressions.This patch release mainly fixes issues in drift_dev:
This patch release mainly fixes issues in drift_dev:
SchemaVerifier implementation.drift_dev schema dump is used on SQLite databases with triggers, views or indexes.0 when no command was selected.generatedAs not being generated for versioned schema imports.And adds two minor API additions to drift:
isNotNull() column filter for the manager APIs.orderBy parameter to more aggregate function extension.This release adds support for window functions in the Dart query builder (through WindowFunctionExpression) and contains improvements to the generator
This release adds support for window functions in the Dart query builder (through WindowFunctionExpression) and contains improvements to the generator:
make-migrations.Fix shared worker feature detection when the main app is compiled with dart2wasm.
dart2wasm.Report SqliteExceptions occurring on workers as SqliteException instances. Previously, they were sent as strings only.
Core drift package:
SqliteExceptions occurring on workers as SqliteException instances. Previously, they were sent as strings only.LazyDatabase being closed without ever being used potentially leaking resources.In the generator:
toString().flutter_test if the core test package is unavailable and warn when database class needs changes for test.Deprecate TypeConverter.json utility in favor of TypeConverter.json2. The new method avoids encoding values twice when mapping drift row classes to JS…
This version improves jsonb support and adds other minor improvements:
TypeConverter.jsonb to directly store values in the JSONB format used by SQLite.TypeConverter.json utility in favor of TypeConverter.json2. The new method avoids encoding values twice when mapping drift row classes to JSON. The documentationrunWithInterceptor method to databases to only apply interceptors in a restricted block.In the generator, we:
7.x of the analyzer package.This patch release fixes the following issues:
This patch release fixes the following issues:
TableStatements.insertAll to only apply a database-specific pragma for SQLite databases.fake_async Zone and then closed outside that zone.Also, drift_dev version 2.23.1 contains one improvement:
This drift release contains smaller fixes and new features:
This drift release contains smaller fixes and new features:
NULLS FIRST and NULLS LAST in manager API.@DataClassName not being recognized.dart_style version.sqlite3) is enabled.Fix generated SQL for insertFromSelect statements with upserts.
insertFromSelect statements with upserts.alterTable for databases where legacy_alter_table is not writable.package:drift/web.dart to be imported into Dart apps compiled with
dart2wasm.Deprecate package:drift_dev/api/migrations.dart in favor of package:drift_dev/api/migrations_native.dart.
sqliteAny() method to tables to declare ANY columns.STRICT and WITHOUT ROWID.dbstat module.package:drift_dev/api/migrations.dart in favor of package:drift_dev/api/migrations_native.dart.row_class_constructor_all_required builder option.dbstat table in drift-file queries when enabling the dbstat module.make-migrations using invalid import URIs in generated test on Windows.shareAcrossIsolates
across hot restarts.Versions 2.21.0 of drift and drift_dev as well as version 0.2.1 of drift_flutter have just been released:
Versions 2.21.0 of drift and drift_dev as well as version 0.2.1 of drift_flutter have just been released:
View.from is now declared to return a JoinedSelectStatement, the type it returns at runtime.drift_flutter: Enable serialization between background isolates where necessary.check constraints not being considered in exported schemas.late final fields. Defining columns with getters => is still supported too.class MyTable extends Table {
// Before:
IntColumn get id => integer().autoIncrement()();
// After:
late final id = integer().nullable()();
}
build.yaml definitions pass build_runner doctor.generate_manager option not consistently being applied to modular builds.make-migrations command which combines the existing schema commands into a single tool.View.from is now declared to return a JoinedSelectStatement, the type it
returns at runtime.This patch release fixes a deadlock that could occur when using concurrent nested transactions, a problem introduced in the 2.20.0 release (https://gi
This patch release fixes a deadlock that could occur when using concurrent nested transactions, a problem introduced in the 2.20.0 release (https://github.com/simolus3/drift/issues/3244). Note that drift_worker.js bundles from drift version 2.20.0 until 2.20.2 also have the issue and need to be updated to apply the fix.
Fix upcoming unreachable_switch_default lint.
unreachable_switch_default lint.This patch release fixes the following issues:
This patch release fixes the following issues:
package:drift/web.dart to the new JS interop SDK libraries. For backwards compatibility, the channel() extension on the MessagePort class in dart:html has been kept.
Once dart:html is removed from the Dart SDK, that extension will have to be removed from drift as well.dart2wasm.drift_worker.js.schema export not respecting column constraints of the target dialect.json_extract return types from context if possible.Mark legacy package:drift/web.dart as deprecated. Users should migrate to package:drift/wasm.dart.
readPool parameter to NativeDatabase. It will spawn an additional pool of isolates used to serve multiple reads in parallel, which can improve performance in some specific workloads.package:drift/web.dart as deprecated. Users should migrate to package:drift/wasm.dart.TableIndex.sql, allowing database indexes to be defined in SQL without using drift files.DataClassName.implementing, which can be used to make drift-generated row classes implement existing interfaces.DriftNativeOptions with shareAcrossIsolates option that will give multiple isolates access to the same drift database without having to manually set up ports.Support version 1.x of package:web.
1.x of package:web.This patch release fixes exclusively not working on the web (#3089). The fix requires a drift_worker.js update.
This patch release fixes exclusively not working on the web (#3089). The fix requires a drift_worker.js update.
Fix exclusively breaking the database connection on the web. Please note that this requires an updated drift_worker.js to fix.
exclusively breaking the database connection on the web. Please note
that this requires an updated drift_worker.js to fix.Drift 2.19.0 expands the migrator API and adds a method to exclusively use the database without a transaction (useful for things like setting pragmas
Drift 2.19.0 expands the migrator API and adds a method to exclusively use the database without a transaction (useful for things like setting pragmas which are unsupported in transactions).
exclusively method to database classes, allowing a block to temporarily take exclusive control over a database connection without starting a transaction.enableMigrations parameter to WasmDatabase to control whether drift migrations are enabled on that database.initiallyDeferred option to references() column builder for foreign key constraints.dropColumn method to Migrator.selectExpressions method to build select statements without a FROM clause.transaction and exclusively will wait for the transaction or the exclusive lock to be set up before invoking their callback now.This release also fixes the following bugs:
BigInt arguments in batched statements sent to web workers. Note that the fix also requires the latest drift_worker.js to be effective.CREATE VIEW statements containing existing row class syntax only supposed to be used during static analysis.drift_dev schema steps generating invalid code when no migrations have been defined yet.While not part of the core packages in this repository, another addition is drift_hrana, which allows using drift with a libsql server - that may be useful for some Dart backends using Turso or related offerings.
The biggest new feature in this release is the addition of manager APIs, which make it much easier to write common simple queries. The new API has bee
The biggest new feature in this release is the addition of manager APIs, which make it much easier to write common simple queries. The new API has been designed to be easier to use and to avoid boilerplate for common CRUD queries. This feature requires additional code to be generated - if you prefer using the existing APIs exclusively, you can use the generate_manager: false builder option.
.drift files if the extension is enabled.AggregateFunctionExpression to write custom aggregate function invocations in the Dart query builder.json_group_array and jsonb_group_array functions now contain an orderBy and filter parameter.generate_manager: false builder optionAggregateFunctionExpression to write custom aggregate function
invocations in the Dart query builder.json_group_array and jsonb_group_array functions now contain an orderBy
and filter parameter.Add the TypeConverter.extensionType factory to create type converters for extension types.
TypeConverter.extensionType factory to create type converters for extension types.BLOB literals on postgres.setup parameter to SchemaVerifier. It is called when the verifier creates database connections (similar to the callback on NativeDatabase) and can be used to register custom functions.companion entry to DataClassName to override the name of the generated companion class.use_sql_column_name_as_json_key builder option.IN expressions in drift files, they now support tuples on the left-hand side and the shorthand syntax for table references and table-valued functions.CREATE VIEW statements.INT64 hint for CREATE TABLE statements.Deprecate Value.ofNullable in favor of Value.absentIfNull, which is more explicit about its behavior and allows nullable types too.
Drift 2.16.0 mostly contains performance and stability improvements:
NativeDatabase.createInBackground).UpdateStatement with database.update outside of a transaction and then calling UpdateStatement.write inside of a transaction will now perform the update inside of the transaction, instead of causing a deadlock.EXPLAIN statements, avoiding schema locks.Value.ofNullable in favor of Value.absentIfNull, which is more explicit about its behavior and allows nullable types too.WasmDatabase to dart:js_interop and package:web.drift_postgresdate or timestamp types.Drift 2.15 introduces new features improving web support and for sharing database classes against different databases (e.g. sqlite3 and Postgres):
Drift 2.15 introduces new features improving web support and for sharing database classes against different databases (e.g. sqlite3 and Postgres):
DialectAwareSqlType, a custom type depending on the runtime dialect. This allows writing "polyfill" types that use native date types on Postgres while falling back to a textual representation on sqlite3 for instance.jsonb functions in the query builder through package:drift/extensions/json1.dart. jsonb functions are also supported by sqlparser when analyzing drift files.enableMigrations parameter to NativeDatabase to disable migrations, a flag useful for existing databases managed with an external schema tool.old and new in CREATE TRIGGER statements.This release fixes a bug in the generator that is potentially breaking: Tables defined in .drift files with a NULL column constraint (e.g. CREATE TABLE users (display_name TEXT NULL, ...)) were not generated correctly - the NULL constraint was absent from the generated schema. This is not a soundness issue since NULL constraints are the default and ignored by sqlite3. However, it means that the actual schema of databases deviates from what drift will now expect, since NULL constraints will be expected from drift 2.15. This can cause issues with the schema validator after upgrading. If you are affected by this problem, the two possible ways to fix this are:
NULL constraints from column declarations in drift files. You don't need a migration for this since they don't affect semantics.NULL constraints. In this case, you'll have to increment the schema version of your database and use Migrator.alterTable(affectedTable) on all affected tables to make it consistent with the schema with NULL constraints that drift is now expecting.Also note that this only applies to drift files and not to NOT NULL constraints, which have always been generated correctly. Finally, older snapshots generated with drift_dev schema generate will continue to not report the NULL constraint, meaning that older migration tests won't break due to this change. If you have any questions or concerns about this, please reach out by opening an issue.
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.enableMigrations parameter to NativeDatabase which can be used to
optionally disable database migrations when opening databases.jsonb functions in the Dart query builder.This minor release fixes bugs in the drift and the drift_dev packages:
This minor release fixes bugs in the drift and the drift_dev packages:
WasmProbeResult.open ignoring the ìnitializeDatabase callback.Variable instances for columns with custom types.__Breaking change__: The name of the generated row class derived from the name of the Dart table name now supports more forms of plurals. For instance…
New features in drift:
QueryInterceptor API to easily monitor or transform all database calls made by drift.count() extension on tables to easily count rows in tables or views.Changes to the generator:
@DataClassName annotation named Categories would now generate a Category class instead of Categorie. This is done in a minor release because we assume users previously running into this are already using @DataClassName as a workaround.drift_dev schema steps public.const row classes when they are extending a class which isn't const.Fix a race condition causing query streams to not emit new data around some transaction setups.
Fix a bug when running batches over serialized communication channels.
Add support for custom types, which are useful when extending drift to support other database engines.
Expression.and and Expression.or to create disjunctions and conjunctions of sub-predicates.TypeConverter.json factory reduces the boilerplate needed to define type converters doing JSON conversions.drift_postgres package is now available on pub.dev.This minor release fixes the following issues:
This minor release fixes the following issues:
readWithConverter throwing an exception for null values in non-nullable columns (#2640).* columns in analyzed SQL queries expanding to more columns than what would be correct (#2641).views crashing the generator (#2636).This drift release adds support for defining a database index in Dart and improves JSON support.
This drift release adds support for defining a database index in Dart and improves JSON support.
Full list of changes:
json_each and json_tree table-valued functions.@TableIndex annotation for table classes to add an index to the table.TypeConverter.json method to define type converters storing JSON values more easily.TypedResult.readWithConverter to read a column with a type converter from a join result row.@TableIndex annotation for table classes to add an index to the
table.json_each and json_tree.TypeConverter.json method to define type converters storing JSON
values more easily.TypedResult.readWithConverter to read a column with a type converter
from a join result row.This minor drift release contains bug fixes and performance improvements for the builder:
This minor drift release contains bug fixes and performance improvements for the builder:
sqlite_schema in drift files.timediff and octet_length functions from sqlite 3.43.0.@UseRowClass with generateInsertable: true when modular code generation is enabled..read() for a column added to a join from the table, fixing a regression in drift 2.11.0.Migrator.runMigrationSteps.This release adds new features to the Dart query builder API:
This release adds new features to the Dart query builder API:
isInExp and isNotInExp to construct IS IN expressions with arbitrary expressions.substr extension on Expression<String> to call the sqlite3 function from the Dart API.Other new additions to drift:
isolateSetup to NativeDatabase.createInBackground() to override native libraries or perform other database-unrelated setup work.WasmDatabase.probe(), a method probing for available implementations and existing databases on the web without opening one directly.drift_dev has also seen some optimizations in how it generates query code, which enables new features:
dialects builder option to generate code supporting multiple SQL dialects.preamble option for non-shared or modular build setups to mirror the preamble option from source_gen:combining_builder.The main new feature of drift 2.10 is the drift_dev schema steps command, which generates a single Dart file with all schema versions of your database
The main new feature of drift 2.10 is the drift_dev schema steps command, which generates a single Dart file with all schema versions of your database available.
A generated API in that file makes it easy to write incremental schema migrations.
Additionally, this release fixes an issue with the new WASM implementation when the set of available storage implements in a browser changes and makes drift_dev print a warning when Dart tables are implicitly added to a database through a transitive import.
schema steps command to drift_dev. It generates an API making it
easier to write safe schema migrations (docs).The biggest feature of this release is stable web support! The WasmDatabase.open factory with a drift web worker is a performant and reliable web impl
The biggest feature of this release is stable web support! The WasmDatabase.open factory with a drift web worker is a performant and reliable web implementation for drift. The new web documentation at https://drift.simonbinder.eu/web/ shows how to use the new API and how to migrate from the old and experimental drift web APIs.
In addition to the new web API, this release
fatal_warnings builder option, causing the build to fail when drift_dev reports warnings.0 from the schemaVersion getter. This has always been broken, so the explicit check leads to a better error message.schemaVersion returning 0, as this causes issues in the migrator.WasmDatabase.open factory as
described in https://drift.simonbinder.eu/web/, you can run a drift database
in modern browsers!Fix prepared statements leaking when the statement cache is disabled.
This patch release fixes the following issues in the core drift package:
This patch release fixes the following issues in the core drift package:
connectToDriftWorker.Also, drift_dev: 2.8.3 and sqlparser: 0.30.1 have been released with these changes:
WITH clauses in triggers.connectToDriftWorker.This drift release adds support for named constructors for existing row types in drift files (#2399) and allows targeting partial indices in DoUpdate
This drift release adds support for named constructors for existing row types in drift files (#2399) and allows targeting partial indices in DoUpdate (#2394).
It also fixes the following noteworthy bugs:
setup callback throws an exception. Instead, drift will retry the next time the database is used.computeWithDatabase is called inside a transaction().analyzer: 5.12.0.setup callback throws an
exception. Instead, drift will retry the next time the database is used.DoUpdate (#2394)computeWithDatabase is called inside a transaction().Add support for CASE expressions without a base in the Dart API with the CaseWhenExpression class.
CASE expressions without a base in the Dart API with the CaseWhenExpression class.package:drift/web/workers.dart library which makes it easier to create web workers for drift.validateDatabaseSchema() work in migration tests.AS aliases in subqueries used in triggers.GROUP BY or HAVING clause.Add insertReturningOrNull for potentially empty inserts.
insertReturningOrNull for potentially empty inserts.insertFromSelect to InsertStatement to run INSERT INTO SELECT
statements.rowid parameter to companions for tables with rowids that don't have a
visible alias for the rowid.DriftRemoteException.DO NOTHING during upsert operations with constraint violationsThe generate_connect_constructor option is now deprecated, as a DatabaseConnection can be passed whereever a QueryExecutor is used too.
This release adds support for general IS operators to the query builder, makes drift isolates much easier to use and allows applying type converters on columns in queries.
isExp, isValue, isNotExp and isNotValue methods to Expression to generate the IS operator in SQL.all() extension on tables and views to quickly query all rows.serializableConnection() and computeWithDatabase() as extensions on databases. The methods allow sharing any drift database between isolates, regardless of how the database has been set up.DatabaseConnection class now implements QueryExecutor, meaning that you no longer need a special .connect() constructor to use it.generate_connect_constructor option is now deprecated, as a DatabaseConnection can be passed whereever a QueryExecutor is used too.MAPPED BY for individual columns in queries or in views defined with SQL.CAST to an enum type in drift files.CAST (x AS DATETIME) and CAST(x AS TEXT) in drift files.LIST() columns having the same result class name.@UseDataClass with extending not working with modular generation.async modifier when mapping queries to existing row classes.One column per quarter.