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 exception when a client disconnects from a drift remote server while processing a pending table update.
schema generate --companions implicitly requiring --data-classes as well.toColumns() not being generated correctly.schema generate when using existing row types on views.Literal subclasses and NumberedVariable.Fix DriftIsolate leaking resources for closed connections.
DriftIsolate leaking resources for closed connections.Your coding agent can read these notes before it upgrades. Set up the MCP server →
This drift release extends support for existing row classes to queries, allows storing enums by their name and handles ANY columns. A full list of imp
This drift release extends support for existing row classes to queries, allows storing enums by their name and handles ANY columns. A full list of improvements and new features:
textEnum() column in Dart or the ENUMNAME column type in .drift files.DriftAny type to handle arbitrary SQL values. It will be used by the generator for columns types declared as ANY in strict tables.drift_dev schema dump can now dump the schema of existing sqlite3 database files as well.case_from_dart_to_sql option with the possible values: preserve, camelCase, CONSTANT_CASE, snake_case, PascalCase, lowercase and UPPERCASE (default: snake_case).updates parameter to Batch.customStatement - it can be used to specify which tables are affected by the custom statement.likeExp to generate LIKE expressions with any comparison expression.UNIQUE keys declared in drift files being written twice.TypedResult.read, increasing performance for joins with lots of tables or columns.Migrator.alterTable not to work if a view references the altered table.customConstraints are now parsed and respected by the generator.This drift release also adds experimental support for record types as existing types for tables or queries. Note that records are experimental in the Dart language, so the feature may be updated or removed depending on its development in the language.
textEnum column builder and EnumNameConverter to be able to store enum
values as string.updates parameter to Batch.customStatement - it can be used to specify
which tables are affected by the custom statement.STRICT tables in drift files declaring a ANY column, drift will now
generate a mapping to the new DriftAny type.likeExp to generate LIKE expression with any comparison expression.UNIQUE keys declared in drift files being written twice.customConstraints not appearing in dumped database schema files.TypedResult.read, increasing performance for joins
with lots of tables or columns.Migrator.alterTable not to
work if a view referenced the altered table.Add the JsonTypeConverter2 mixin. It behaves similar to the existing json type converters, but can use a different SQL and JSON type.
JsonTypeConverter2 mixin. It behaves similar to the existing json type converters, but can use a different SQL and JSON type.isInValues and isNotInValues methods 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.TableStatements.insertAll to atomically insert multiple rows.singleClientMode to remote() and DriftIsolate connections to make the common case with one client more efficient.NativeDatabase.createInBackground as a drop-in replacement for NativeDatabase(). It creates a drift isolate behind the scenes, avoiding all of the boilerplate usually involved with drift isolates.__Potentially breaking bug-fix__: Fix the nullability of columns generated for Dart-defined views. See the documentation for details.
operator ~, bitwiseAnd and bitwiseOr.uniqueKeys overrides into a database schema, allowing them to be properly tested in schema tests.analyzer package.Changes in drift version 2.1.0:
Changes in drift version 2.1.0:
watchSingle() with a stream emitting a non-singleton list at some point.OrderingTerm.nulls to control the NULLS FIRST or NULLS LAST clause in Dart.Changes in drift_dev version 2.1.0 and sqlparser version 0.23.2:
fts5 tables with external content tables.rtree module.Nothing published for this version
__drift 2.0.2__: Revert the breaking change around QueryRow.read only returning non-nullable values now - it was causing issues with type inference in…
This patch release fixes some issues introduced by the upgrade to drift 2.0:
QueryRow.read only returning non-nullable values now - it was causing issues with type inference in some cases.scoped_dart_components, making it easier to re-use them in your own methods.@ or $ variables instead of crashing.Introduced isBetween and isBetweenValues methods for comparable expressions (int, double, datetime) to check values for both an upper and lower bound
isBetween and isBetweenValues methods for comparable expressions (int, double, datetime)
to check values for both an upper and lower boundBOOLEAN and DATETIME columns declared in a sql file to the appropriate type
(both used to be double before).\r as whitespace in moor files and compiled queriesInsertable.createCompanion (it was declared as an
internal method, but you will have to re-run the build)The first major update to the drift packages contains a number of breaking changes and removes some obsolete features. This includes:
The first major update to the drift packages contains a number of breaking changes and removes some obsolete features. This includes:
toSql and fromSql.SqlTypeSystem and subtypes of SqlType:
DriftSqlType enumSqlTypes, reachable via database.options.types.Expressions (including Columns) always have a non-nullable type parameter now. They are implicitly nullable, so TypedResult.read now returns a nullable value.QueryRow.read can only read non-nullable values now. To read nullable values, use readNullable.includeJoinedTableColumns parameter on selectOnly(). The method now behaves as if that parameter was turned off. To use columns from a joined table, add them with addColumns.fromData factory on generated data classes. Use the map method on tables instead.BEGIN or COMMIT across database implementations.writeReturning to update statements; deleteReturning and goAndReturn to delete statatements.💡: More information on how to migrate is available in the documentation.
This is the first major update after the initial release and moor and we have a lot to cover:
.moor files can now have their own imports and queries, you can embed Dart in sql queries
using the new templates feature and we have a prototype of a pure-Dart SQL IDE ready.
Finally, we also removed a variety of deprecated features. See the breaking changes
section to learn what components are affected and what alternatives are available.
.moor files were introduced in moor 1.7 as an experimental way to declare tables by using
CREATE TABLE statements. In this version, they become stable and support their own import
and query system. This allows you to write queries in their own file:
CREATE TABLE users (
id INT NOT NULL PRIMARY KEY AUTOINCREMENT,
name VARCHAR NOT NULL
);
findByName: SELECT * FROM users WHERE name LIKE :query;
When this file is included from a @UseMoor annotation, moor will generate methods to run the
query. Of course, you can also write Dart queries for tables declared in sql:
Stream<User> loadUserById(int id) {
return (select(users)..where((u) => u.id.equals(2))).watchSingle();
}
Moor files can also import other moor files by using an import 'other.moor'; statement at the
top. Then, all tables defined in other.moor will also be available to the current file.
Moor takes Dart and SQL interop even further with the new "Dart in SQL templates". You can define a query like this:
findDynamic: SELECT * FROM users WHERE $condition;
And moor will generate a method findDynamic(Expression<bool, BoolType> condition) for you. This
allows you to bind the template with a predicate as complex as you'd like. At the moment, Dart
templates are supported for expressions, OrderBy, OrderingTerm and Limit.
INSERT statements can now be used as a compiled statement - both in moor files and
in a @UseMoor or @UseDao annotation. A new builtin linter will even warn you when you forget
to provide a value for a non-nullable column - right at compile time!
And finally, we now generate better query code when queries only return a single column. Instead of generating a whole new class for that, we simply return the value directly.
We released an experimental version of moor built on top of dart:ffi. It works
cross-platform and is much, much faster than moor_flutter. It you want to try
it out, read the docs here.
Constant<String> can now be written to SQL, it used to throw before. This is useful
if you need default values for strings columns. This also works for BLOBS
(Constant<Uint8List>).LazyDatabase for when you want to construct a database asynchronously (for instance, if
you first need to find a file before you can open a database).THIS LIKELY AFFECTS YOUR APP: Removed the transaction parameter for callbacks
in transactions and beforeOpen callbacks. So, instead of writing
transaction((t) async {
await t.update(table)...;
});
simply write
transaction(() async {
await update(table)...;
});
Similarly, instead of using onOpen: (db, details) async {...}, use
onOpen: (details) async {...}. You don't have to worry about calling methods on
your database instead of a transaction objects. They will be delegated automatically.
On a similar note, we also removed the operateOn parameter from compiled queries.
Compiled queries that return only a single column (e.g. SELECT COUNT(*) FROM users)
will just return their value (in this case, an int) now. Moor no longer generates a
new class in that case.
Removed MigrationStrategy.onFinished. Use beforeOpen instead.
Compiled sql queries starting with an underscore will now generate private match queries.
Previously, the query _allUsers would generate a watchAllUsers method, that has been
adopted to _watchAllUsers. The generate_private_watch_methods builder option, which
backported this fix to older versions, has thus been removed.
Removed InsertStatement.insertOrReplace. Use insert(data, orReplace: true) instead.
Removed the diff util and MoorAnimatedList. Use a third party library for that.
This minor release fixes a bug where the NativedDatabase implementation would not dispose statements if running them threw an exception (https://githu
This minor release fixes a bug where the NativedDatabase implementation would not dispose statements if running them threw an exception (https://github.com/simolus3/drift/issues/1917).
NativeDatabase not disposing statements if running them threw an
exception #1917.This drift release brings the following new features and improvements:
This drift release brings the following new features and improvements:
int64() column builder to store large integers. These integers are still stored as 64-bit ints in the database, but represented as a BigInt in Dart. This enables better web support for integers larger than 2⁵². More details are in the documentation.filter and distinct support to groupConcat.sqflite-based implementation if the first operation in a transaction is a future backed by a query stream.analyzer packageThis release also uses version 0.22.0 of the sqlparser package with the following changes:
DISTINCT misuse in aggregate function calls.RIGHT and FULL joins, IS (NOT) DISTINCT FROM expressions)SUM() calls around int "subtypes" like booleans.backends api, making it easier to write database drivers that work with moor. Apart from moor_flutter, new experimental backends can be checked out from git:
encrypted_moor: An encrypted moor database: https://github.com/simolus3/moor/tree/develop/extras/encryptionmoor_mysql: Work in progress mysql backend for moor. https://github.com/simolus3/moor/tree/develop/extras/mysql.moor files! Instead of declaring your tables in Dart, you can choose to declare them with sql by writing the CREATE TABLE statement in a .moor file. You can then use these tables in the database and with daos by using the include parameter on @UseMoor and @UseDao. Again, please notice that this is an experimental api and there might be some hiccups. Please report any issues you run into.Also see the full changelog for the relases from 1.2 to 1.6.
Add the unique() method to columns and the uniqueKeys override to define unique constraints in Dart tables.
unique() method to columns and the uniqueKeys override to define unique constraints in Dart tables.check() method to the Dart column builder to generate CHECK column constraints.JsonTypeConverter.package:drift/wasm.dart library. It uses WebAssembly to access sqlite3 without any external JavaScript libraries, but requires you to add a WebAssembly module to the web/ folder.
Please note that this specific library is not subject to semantic versioning until it leaves its experimental state. It also isn't suitable for production use at the moment.package:js to wrap sql.js.Add DataClassName.extending to control the superclass of generated row classes.
DataClassName.extending to control the superclass of generated row classes.setup parameter to the constructors of WebDatabase too.CREATE VIEW statements.MultiExecutor.withReadPool constructor to load-balance between multiple reading executors. This can be used in a multi-isolate approach if some queries are expensive.drift_dev also has new features:
validateDatabaseSchema extension to package:drift_dev/api/migrations.dart. It validates that the schema of a database at runtime matches what one would expect. This can be used to test the correctness of migrations at runtime without special testing code.Deprecate the from(table) API introduced in 1.3.0. Having the methods on the table instances turned out to be even easier!
update(todos).replace(newEntry), you can now write todos.replaceOne(newEntry).from(table) API introduced in 1.3.0. Having the methods on the table instances turned out to be even easier!LIST(SELECT ...) as a result column to get all results of the inner select as a List in the result set.Add the from(table) method to generated databases. It can be used to write common queries more concisely.
from(table) method to generated databases. It can be used to write common queries more concisely.groupConcat nullable in the Dart API.NativeDatabase when multiple statements are run in a single call. In previous versions, parts of the SQL string would otherwise be ignored.This minor release implements changes in the generated code necessary to support streams from views in the Dart API.
This minor release implements changes in the generated code necessary to support streams from views in the Dart API.
Additionally,
watchSingle() and watchSingleOrNull() now throws an error with a stack trace when used on a query emitting multiple rows.sqlparser 0.19.1, group_concat was made nullable as evaluates to NULL for empty groups.getSingle() or watchSingle() is used on a
query emitting more than one row.This patch release contains the following changes:
This patch release contains the following changes:
serialize parameter to false on the DriftIsolate methods.The generator, released as drift_dev version 1.1.1 contains a fix related to custom row classes with generateInsertable: true.
Transaction support via GeneratedDatabase.transaction.
GeneratedDatabase.transaction.toString()This release consists of drift version 1.1.0, drift_dev version 1.1.0 and sqlparser version 0.19.0:
references method to BuildColumn to reference a column declared in another Dart table.generateInsertable option to @UseRowClass. When enabled, the generator will emit an extension to use the row class as an Insertable.new_sql_code_generation option in specific scenarios..drift files.generatedAs method to declare generated columns for Dart tables.OrderingTerm.random to fetch rows in a random order.STRICT tables defined in .drift files..drift files.Big thanks to everyone who contributed to this release!
Add DoUpdate.withExcluded to refer to the excluded row in an upsert clause.
DoUpdate.withExcluded to refer to the excluded row in an upsert clause.where clause to DoUpdate constructorsWith this release, moor has been renamed to drift. No immediate action is necessary, the moor package will continue to work until the next breaking release. The functionality of moor 4.6.0 is identical to drift 1.0.1.
An automatic migration tool can help you make the switch from moor to drift in minutes. See the documentation for all the details. Thanks!
DoUpdate.withExcluded to refer to the excluded row in an upsert clause.where clause to DoUpdate constructorsThis is the initial release of the drift package (formally known as moor).
For an overview of old moor releases, see its changelog.
Nothing published for this version
One column per quarter.