clear method
Deletes all the entries of the repository.
If userId
is not null, the only enties that will be deleted will have the same user id.
Implementation
@override
Future<void> clear({String? userId}) async {
final query = userId != null
? _collectionReference.where(Model.userIdKey, isEqualTo: userId)
: _collectionReference;
await query.get().then((value) async {
for (final doc in value.docs) {
await _collectionReference.doc(doc.id).delete();
}
});
}