Drift: Persistence library for Dart

Learn more Get from pub

With a fluent query api, a powerful sql analyzer, auto-updating streams and much more, drift makes persistence fun. Scroll down to learn about its key features, or visit the getting started guide for a step-by-step guide on using drift.

Drift is an easy to use, reactive persistence library for Flutter apps. Define tables in Dart or SQL and enjoy a fluent query API, auto-updating streams and more!

Declarative tables, fluent queries

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

Get started now

Prefer SQL? Drift got you covered!

Drift contains a powerful sql parser and analyzer, allowing it to create typesafe APIs 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.

Learn more

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!

Key features

Here are some of the many ways drift helps you write awesome database code:

  • Auto-updating streams: With drift, any query - no matter how complex - can be turned into a stream that emits new data as the underlying data changes.
  • Polyglot: Drift lets you write queries in a fluent Dart api or directly in SQL - you can even embed Dart expressions in SQL.
  • Boilerplate-free: Stop writing mapping code yourself - drift can take of that. Drift generates Dart code around your data so you can focus on building great apps.
  • Flexible: Want to write queries in SQL? Drift verifies them at compile time and generates Dart apis for them. Prefer to write them in Dart? Drift will generate efficient SQL for Dart queries too.
  • Easy to learn: Instead of having to learn yet another ORM, drift lets you write queries in SQL and generates typesafe wrappers. Queries and tables can also be written in Dart that looks similar to SQL without loosing type-safety.
  • Fast and powerful: With the new ffi backend, drift can outperform key-value stores without putting any compromises on the integrity and flexibility that relational databases provide. Drift is the only major persistence library with builtin support for multiple isolates.
  • Well tested and production ready: Each component of drift is verified by a wide range of unit and integration tests. Drift powers many Flutter apps in production.
  • Cross-Platform: Drift works on iOS, Android, Linux, macOS, Windows and on the web. It doesn't even require Flutter. See supported platforms.