FirebaseRepository<T extends DBModelI> class abstract

Provide additional functionality to a FirebaseRepository

Constructors

FirebaseRepository()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

add({required T item, SetOptions? setOptions, required String type, DocumentReference<Object?>? parent}) Future<DocumentReference<Object?>>
Given item will be added to the collection with name type, which is inside the document parent. If parent is null, global collection with name type will be used to store the item.
addList({required Iterable<T> items, required String type, DocumentReference<Object?>? parent}) Future<void>
Same as FirebaseRepository.add but will store a Iterable of given items and return a Iterable of DocumentReferences.
fromSnapshot(DocumentSnapshot<Map<String, dynamic>> snapshot, SnapshotOptions? options) → T
Returns a T (of DBModel) when a snapshot is given. Can return null if the snapshot is in bad format.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
query({required QueryTransformer<T> spec, required String type, DocumentReference<Object?>? parent, bool includeMetadataChanges = false}) Stream<Iterable<T>>
Query some data from a Firestore collection with name type in the document with DocumentReference parent according to the given rule in the specification.
queryGroup({required QueryTransformer<T> spec, required String collectionPath, bool includeMetadataChanges = false}) Stream<Iterable<T>>
Usage is as same as in the FirebaseRepository.query, but this is for collection group querying.
queryGroupSingle({required QueryTransformer<T> spec, required String collectionPath, Source source = Source.serverAndCache}) Future<Iterable<T>>
Same as FirebaseRepository.queryGroup but instead of returning a Stream this will return a Future with the latest values in the Firestore.
querySingle({required QueryTransformer<T> spec, required String type, DocumentReference<Object?>? parent, Source source = Source.serverAndCache}) Future<Iterable<T>>
Same as FirebaseRepository.query but instead of returning a Stream this will return a Future with the latest values in the Firestore.
remove({required T item}) Future<void>
Delete the document corresponding to the item. If the reference of the item (DBModel.ref) is null nothing will happen.
toMap(T value, SetOptions? options) Map<String, Object?>
Converts the given item to a Map that can be stored in Firestore.
toString() String
A string representation of this object.
inherited
update({required T item, SetOptions? setOptions, required String type, DocumentReference<Object?>? parent, MapperCallback<T>? mapper}) Future<DocumentReference<Object?>>
Update the document which is corresponding to the given item.

Operators

operator ==(Object other) bool
The equality operator.
inherited