Skip to content

firestore_odmType-safe Firestore for Flutter

Describe your documents once and get typed queries, updates, aggregates, transactions and streams. A misspelled field is a compile error, not a production bug. The maintained successor to cloud_firestore_odm.

dart
final adults = await db.users
    .where(($) => $.age(isGreaterThanOrEqualTo: 18))
    .orderBy(($) => ($.age(descending: true), $.name()))
    .limit(20)
    .get(); // List<User>

await db.users('kim').patch(($) => [$.age.increment(1), $.lastLogin.serverTimestamp()]);

final stats = await db.users
    .aggregate(($) => (count: $.count(), averageAge: $.age.average()))
    .get(); // ({int count, double averageAge})