firewatch library
Firewatch – opinionated Firestore repositories for responsive UIs.
This package provides:
FirestoreCollectionRepository
for managing live queries and paginationFirestoreDocRepository
for 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
-
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.
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.
-
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).