FirestoreCollectionRepository<T extends JsonModel> class
A Firestore collection repository designed for responsive UIs:
- Reacts to auth changes and extra dependencies
- Supports live queries (subscribe) or one-shot fetches
- Exposes pagination via a live "window" (limit that grows with
loadMore
) - Keeps per-item notifiers in sync for efficient item detail widgets
- Inheritance
-
- Object
- ChangeNotifier
- ValueNotifier<
List< T> > - FirestoreCollectionRepository
Constructors
-
FirestoreCollectionRepository.new({required T fromJson(Map<
String, dynamic> ), required ColRefBuilder colRefBuilder, FirebaseFirestore? firestore, QueryMutator? queryBuilder, AuthUidListenable? authUid, List<Listenable> dependencies = const [], bool subscribe = true, int pageSize = 25}) - Creates a new FirestoreCollectionRepository.
Properties
-
add
→ Command<
Map< String, dynamic> , String?> -
Adds a new document to the collection.
latefinal
-
delete
→ Command<
String, void> -
Deletes a document from the collection.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
hasInitialized
→ ValueNotifier<
bool> -
final
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
-
hasMore
→ ValueNotifier<
bool> -
final
- isInitializing → bool
-
no setter
-
isLoading
→ ValueNotifier<
bool> -
Loading flags to help drive UI states.
final
- isRefreshing → bool
-
no setter
-
patch
→ Command<
Patch, void> -
Partially updates fields on an existing document.
latefinal
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
set
→ Command<
T, void> -
Creates or replaces a document in the collection.
latefinal
- showEmpty → bool
-
no setter
-
update
→ Command<
T, void> -
Fully updates an existing document.
latefinal
-
value
↔ List<
T> -
The current value stored in this notifier.
getter/setter pairinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
override
-
loadMore(
) → Future< void> - Load the next page. In realtime mode this increases the live window.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifierFor(
String docId) → ValueNotifier< T?> - Per-item notifier (kept in sync from the collection results).
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
refresh(
) → Future< void> - Force a re-attach / refetch using current auth, deps, and query.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
resetPages(
) → Future< void> - Reset to the first page (useful when filters change).
-
setQuery(
QueryMutator? qb) → void -
Swap the active query; pass
null
to clear and use base collection. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited