Drift: Persistence library for Dart

Drift is the relational persistence library for your Dart and Flutter apps. Write type-safe queries in Dart or SQL, enjoy auto-updating streams, easily managed transactions and so much more to make persistence fun.

Get started

Declarative tables, fluent queries

With drift, you can declare your database tables and queries in pure Dart without having to miss out on advanced SQL features. Drift will take care of creating the tables and generate code that allows you run fluent queries on your data.

Get started now

Definitely relational

Drift is not the kind of ORM that tries to hide SQL away and then breaks down at the first aggregation or non-obvious join.

Instead, drift embraces relational databases with an Dart API that's easy to learn while still being close to SQL. Advanced expressions or subqueries are supported out of the box.

Safe schemas

A well-chosen SQL schema enables type-safe queries and avoids hard-to-spot mistakes. Thanks to drift's extensive support for schema migrations, changing schemas is a safe and easy process. Further, drift provides a complete test toolkit to help you test migrations between all your revisions.

All about schema migrations

Prefer SQL? Drift's got you covered!

Drift ships a powerful SQL parser and analyzer, allowing it to create type-safe methods for all your SQL queries. All SQL queries are validated and analyzed during build-time, so drift can provide hints about potential errors quickly and generate efficient mapping code. Of course, you can mix SQL and Dart to your liking.

Using SQL with Drift

Supported on your favorite platform

Drift's core APIs are written to support a range of database libraries as backends, it doesn't even require Flutter. Drift has primary first-class support for Android, iOS, macOS, Linux Windows and the web.

Other database libraries can easily be integrated into drift as well.

All platforms

And much more!

Drift provides auto-updating streams for all your queries, makes dealing with transactions and migrations easy and lets your write modular database code with DAOs. When using drift, working with databases in Dart is fun!