FirestoreHelper class

Constructors

FirestoreHelper({required bool includeAdditionalFields, bool isLoggingEnabled = !kReleaseMode})
Exclude from coverage since we are using special test constructor.
FirestoreHelper.test({required bool includeAdditionalFields, required FirebaseFirestore firebaseFirestore, required LoggingService loggingService})

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

addDocument(List<String> paths, Map<String, dynamic> update) Future<String?>
Adds a new document into the collection in Firebase.
addDocumentWithId(List<String> paths, Map<String, dynamic> update) Future<String?>
Adds a new document into the collection in Firebase.
areMoreDocumentsAvailable<T>({required Query<Object?> query, required DocumentSnapshot<Object?> lastDocumentSnapshot, required T? onDocumentSnapshot(DocumentSnapshot<Object?> documentSnapshot)}) Future<bool>
Retrieves true if there are more items and false if there are no more items for the specific query. This method is mostly used for pagination purpose.
deleteDocument(List<String> paths) Future<bool>
Deletes existing document from Firebase.
deleteDocumentsByQuery(Query<Object?> query) Future<bool>
Deletes existing documents from Firebase.
getDocument<T>(List<String> paths, {required String logReference, required T? onDocumentSnapshot(DocumentSnapshot<Object?> documentSnapshot)}) Future<T?>
Retrieves a document from Firestore.
getDocuments<T>({required Query<Object?> query, required String logReference, required T? onDocumentSnapshot(DocumentSnapshot<Object?> documentSnapshot), DocumentSnapshot<Object?>? lastDocumentSnapshot}) Future<List<T>?>
Retrieves list of documents from Firestore. It simplifies pagination flow, so services doesn't need to contain boilerplate code.
getDocumentsCount({required Query<Object?> query}) Future<int?>
Retrieves int count of the documents within specific query.
getPathToDocument(List<String> paths) String
hasAnyDocuments<T>({required Query<Object?> query, required T? onDocumentSnapshot(DocumentSnapshot<Object?> documentSnapshot)}) Future<bool>
Retrieves true if there are more than one document within specific query.
listenToDocument<T>(List<String> paths, {required String logReference, required ValueSetter<DocumentSnapshot<Object?>> onDocumentChange}) StreamSubscription<DocumentSnapshot<Object?>>
Listening for the stream of DocumentSnapshot from Firestore. In case of any changes - onDocumentChange will get fired.
listenToDocumentsStream({required String logReference, required Query<Object?> query, required ValueSetter<DocumentChange<Object?>> onDocumentChange, DocumentSnapshot<Object?>? lastDocumentSnapshot}) StreamSubscription<QuerySnapshot<Object?>>
Listening for the stream of QuerySnapshot from Firestore.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
updateDocument(List<String> paths, Map<String, dynamic> update) Future<bool>
Updates existing document in Firebase.

Operators

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