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.
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.
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.
Prefer SQL? Drift's got you covered!
Drift ships a powerful sql parser and analyzer, allowing it to create typesafe 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.
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.
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. We even have a sql IDE builtin to the project When using drift, working with databases in Dart is fun!