flutter_local_db
3.0.6, released 7 weeks ago by jhonacode.com
Embedded local database for Flutter with Rust/LMDB backend, Diesel-style queries, and reactive streams.
What it does
Provides a local database supporting both key-value records and relational tables mapped directly from your existing data models. Offers Diesel-style typed queries, joins, aggregates, transactions, offline-first sync, and reactive streams.
AI-written summary of version 3.0.6, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want an offline-first Flutter application with complex querying requirements.
- You prefer writing queries using Diesel-style DSL without using build_runner or complex code generation.
- You need high-performance local storage backed by Rust and LMDB.
Skip it when
- Your application targets platforms other than Android, iOS, web (key-value only), Windows, macOS, and Linux.
- You need standard SQLite features through standard SQL strings rather than a Rust-powered query DSL.
Strengths
- No code generation or macros required for tables.
- Supports reactive streams via watch queries.
- Built on top of a fast Rust and LMDB engine with built-in offline-first sync support.
Weaknesses
- Tables require the db_dsl_lints analyzer plugin for typed field extensions to avoid manual string-based field paths.
- Full database functionality (tables) is limited to non-web platforms; web only supports the key-value API.
Setup
- Kind
- FFI (native library)
- Effort
- Low
- Code generation
- Yes (build_runner)
- Direct dependencies
- 9
Ships prebuilt with a build hook bundling native libraries for all target platforms. Enable the db_dsl_lints analyzer plugin in analysis_options.yaml for typed table fields.
await LocalDB.init();
final t = User.table;
await t.insert([ana, luis]);
final adults = await t
.filter(t.city.eq('Lima').and(t.age.gt(30)))
.order(t.age.desc())
.limit(20);Alternatives
Packages that do the same job and could replace flutter_local_db.
- drift
If you prefer a robust, type-safe SQLite database for Flutter with built-in SQL support and comprehensive migration tooling.
99Compare - sqflite
If you want a lightweight and widely-used standard SQLite plugin with direct SQL execution.
96Compare - shared_preferences
If you only need simple key-value persistence without tables or complex queries.
97Compare
Works with
Packages commonly used together with flutter_local_db: ones it builds on, ones built on it, and its own family.
- webflutter_local_db depends on itLightweight bindings for browser APIs via JS interop
- hooksflutter_local_db depends on itDart API for the JSON-based protocol for package build and link hooks.
- code_assetsflutter_local_db depends on itProvides the hook protocol specification for bundling native code with Dart packages.
- ffiflutter_local_db depends on itUtilities for working with Foreign Function Interface (FFI) code in Dart.
- path_providerflutter_local_db depends on itProvides Flutter APIs to locate common filesystem directories on Android, iOS, macOS, Linux and Windows.