Declarative tables, fluent queries!
With moor, you can write your database tables in pure Dart without having to miss out on advanced sqlite features. Moor will take care of creating the tables and generate code that allows you run fluent queries on your data.
Prefer SQL? Moor got you covered!
Moor 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 moor can provide hints about potential errors quickly and generate efficient mapping code.
And much more!
Moor 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 moor, working with databases in Dart is fun!
Key moor featuresHere are some of the many ways moor helps you write awesome database code:
- Auto-updating streams: With moor, any query - no matter how complex - can be turned into a stream that emits new data as the underlying data changes.
- Polyglot: Moor lets you write queries in a fluent Dart api or directly in SQL - you can even embed Dart expressions in SQL.
- Safety: Moor can verify your table declarations and queries at compile time, providing helpful and descriptive hints when it finds problems.
- Boilerplate-free: Stop writing mapping code yourself - moor can take of that. Moor generates Dart code around your data so you can focus on building great apps.
- Flexible: Want to write queries in SQL? Moor verifies them at compile time and generates Dart apis for them. Prefer to write them in Dart? Moor will generate efficient SQL for Dart queries.
- Easy to learn: Instead of having to learn yet another ORM, moor 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
moor_ffibackend, moor can outperform key-value stores without putting any compromises and the integrity and flexibility that relational databases provide. Moor is the only major persistence library with builtin support for multiple isolates.
- Well tested and production ready: Each component of moor is verified by a wide range of unit and integration tests. Moor powers many Flutter apps in production.
- Cross-Platform: Moor works on iOS, Android, Linux, macOS, Windows and on the web. It doesn’t even require Flutter.