NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
pub.dev, #346 most downloaded on pub.dev
Dev-dependency for users of drift. Contains the generator and development tools.
Latest stable
2.35.3
Last release 10 days ago
08 Nov 2026
Ships fairly regularly
a new release about every 3 weeks
Nearly every release is documented
notes for 60 of the last 60 stable releases
4 versions withdrawn
withdrawn after publishing
5 years old
98 releases · first in 2021
Drag across the ruler to compare, or tap a release to open it.
Add fatal_warnings builder option to fail the build when drift reports warnings.
fatal_warnings builder option to fail the build when drift reports warnings.Allow Dart-defined tables to reference imported tables through SQL #2433.
Fix generated to write qualified column references for Dart components in drift files if the same table is available under different names.
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Add documentation comments for comments on columns in drift files.
Support named constructors for existing row types in drift files (#2399).
analyzer: 5.12.0.Make validateDatabaseSchema() work in migration tests.
validateDatabaseSchema() work in migration tests.Fix invalid schema verification code being generated for columns with a clientDefault.
clientDefault.Fix generated code for blob columns when modular generation is enabled.
blob columns when modular generation is enabled.Fix an error resolving multiple table references across different files.
The generate_connect_constructor option is now deprecated, as a DatabaseConnection can be passed wherever a QueryExecutor is used too.
MAPPED BY for individual columns in queries or in views defined with SQL.CAST (x AS DATETIME) and CAST(x AS TEXT) in drift files.CAST to an enum type in drift types.generate_connect_constructor option is now deprecated, as a DatabaseConnection
can be passed wherever a QueryExecutor is used too.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.Nothing published for this version
Improvements and fixes for schema files:
schema generate --companions implicitly requiring --data-classes as well.toColumns() not being generated correctly.schema generate when using existing
row types on views.Add support for textEnum columns in Dart (or ENUMNAME in .drift) to store enum columns as text (via Enum.name).
textEnum columns in Dart (or ENUMNAME in .drift) to store enum columns as text (via Enum.name).case_from_dart_to_sql option with the possible values: preserve, camelCase, CONSTANT_CASE, snake_case, PascalCase, lowercase and UPPERCASE (default: snake_case).drift_dev schema dump can now dump the schema of existing sqlite3 database files as well.customConstraints are now parsed and respected by the generator.Fix a crash in schema generate.
schema generate.Fix a builder crash when importing triggers or indices.
Fix invalid code being generated through drift_dev schema generate.
drift_dev schema generate.Re-implement drift's internal analyzer to make the build process more efficient.
__Potentially breaking bug-fix__: Fix the nullability of columns generated for Dart-defined views.
uniqueKeys overrides into a database schema.analyzer package.Nothing published for this version
Analysis support fts5 tables with external content tables.
fts5 tables with external content tables.rtree module.Generate public typedefs for the signatures of scoped_dart_components, making it easier to re-use them for own methods.
scoped_dart_components,
making it easier to re-use them for own methods.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)not_shared builder when exporting schemas.Finally, we also removed a variety of deprecated features. See the breaking changes section to learn what components are affected and what alternative…
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.
null_aware_type_convertersnew_sql_code_generationcompact_query_methodsThese changes help reduce complexity in the generator.
This small update to drift_dev supports the latest version of the analyzer_plugin package and removes usages of deprecated analyzer APIs.
This small update to drift_dev supports the latest version of the analyzer_plugin package and removes usages of deprecated analyzer APIs.
analyzer and analyzer_plugin packages.Support custom columns via type converters. See the docs for details on how to use this feature.
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.
int64 columns..drift files.Write Dart references into schema files.
check and unique
column constraints in Dart tables.Fix crash when reading dynamic type converters.
Support migrations from moor_flutter to drift_sqflite in the migrate command.
moor_flutter to drift_sqflite in the migrate
command.Add validateDatabaseSchema extension to api/migrations.dart. It validates that the schema of a database at runtime matches what one would expect.
validateDatabaseSchema extension to api/migrations.dart. It validates
that the schema of a database at runtime matches what one would expect.Generator support for the LIST() feature introduced in drift 1.4.
LIST() feature introduced in drift 1.4..drift files not being available in all cases.- Support drift version 1.3.x.
drift version 1.3.x.Support the latest versions of analyzer and analyzer_plugin.
analyzer and analyzer_plugin.analyzer and analyzer_plugin packages.Generate code needed to support streams of views.
Improve error handling around custom row classes.
Transaction support via GeneratedDatabase.transaction.
GeneratedDatabase.transaction.toString()drift-named files when generating schema migrations (#1486)new_sql_code_generation
option in specific scenarios..moor.dart part files in the migrate command.With this release, running moor_generator migrate will also rewrite usages of the moor plugin in an analysis_options.yaml file.
With this release, running moor_generator migrate will also rewrite usages of the moor plugin in an analysis_options.yaml file.
analysis_options.yaml files in the drift_dev migrate command.This is the initial release of the drift_dev package (formally known as moor_generator). For an overview of old moor releases, see its changelog.
This is the initial release of the drift_dev package (formally known as moor_generator).
For an overview of old moor releases, see its changelog.
Nothing published for this version
One column per quarter.