Skip to content
pubscout

firestore_odm

5.3.0, released 7 weeks ago by sylphx.com

Type-safe Firestore ODM for Flutter and Dart with code generation.

WASM-ready
$ flutter pub add firestore_odm
Source repository

What it does

Generates typed queries, updates, aggregates, transactions, and streams for Firestore documents based on model descriptions. It provides compile-time safety for fields, filters, and partial updates while keeping runtime performance close to raw cloud_firestore.

AI-written summary of version 5.3.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want type-safe queries and partial updates for Cloud Firestore
  • You need fast build-time code generation for your Firebase data models

Skip it when

  • You use backend platforms other than Cloud Firestore
  • You prefer writing raw string-based Firestore queries without code generation

Strengths

  • Typed filters, ordering, nested fields, and aggregations
  • Fast build times compared to legacy alternatives
  • Built-in support for transactions, batches, and subcollections

Weaknesses

  • Requires running build_runner for code generation after model edits
  • Experimental features like Firestore Pipelines require an Enterprise database

Setup

Kind
Flutter widgets
Effort
Medium
Code generation
Yes (build_runner)
Direct dependencies
3

Requires adding firestore_odm, cloud_firestore, and firebase_core, plus dev dependencies firestore_odm_builder and build_runner, followed by running code generation.

final db = FirestoreODM(appSchema);
final adults = await db.users
    .where(($) => $.age(isGreaterThanOrEqualTo: 18))
    .get();

Alternatives

Packages that do the same job and could replace firestore_odm.

Works with

Packages commonly used together with firestore_odm: ones it builds on, ones built on it, and its own family.