firewatch library
Firewatch – opinionated Firestore repositories for responsive UIs.
This package provides:
FirestoreCollectionRepositoryfor managing live queries and paginationFirestoreDocRepositoryfor document-scoped state- Command wrappers (
add,set,patch,update,delete) for CRUD operations
Designed to integrate with ValueNotifier and Listenable patterns for Flutter apps.
Example:
final repo = FirestoreCollectionRepository<User>(
firestore: FirebaseFirestore.instance,
fromJson: User.fromJson,
colRefBuilder: (fs, uid) => fs.collection('users').doc(uid).collection('entries'),
);
repo.add.execute({'name': 'Alice'});
Classes
-
FirestoreCollectionGroupRepository<
T extends JsonModel> - A Firestore collection-group repository for responsive UIs:
-
FirestoreCollectionRepository<
T extends JsonModel> - A Firestore collection repository designed for responsive UIs:
-
FirestoreDocRepository<
T extends JsonModel> - A small, opinionated single-document repository that:
- JsonModel
- A minimal contract for Firestore-backed entities.
Functions
-
parentIdOf(
DocumentReference< Object?> ref) → String? - Safely extracts the parent document ID for a Firestore document reference.
Typedefs
-
AuthUidListenable
= ValueListenable<
String?> - Firewatch avoids imposing an auth SDK. Instead, it accepts any ValueListenable that exposes the current user UID.
-
ColRefBuilder
= CollectionReference<
Map< Function(FirebaseFirestore fs, String? uid)String, dynamic> > - A builder function that produces a typed Firestore collection reference.
-
GroupPatch
= ({Map<
String, Object?> data, String path}) - Represents a partial update to a Firestore document identified by path.
-
Patch
= ({Map<
String, Object?> data, String id}) - Represents a partial update to a Firestore document.
-
QueryMutator
= Query<
Map< Function(Query<String, dynamic> >Map< base)String, dynamic> > - Mutates a base collection query (e.g., add where/order/limit).
-
QueryRefBuilder
= Query<
Map< Function(FirebaseFirestore fs, String? uid)String, dynamic> > -
A builder function that produces a Firestore
Queryfor a collection group.