one<T> method
- dynamic object, {
- String? subcollection,
- GetOptions? getOptions,
override
Checks if a document exists in Firestore using its type and ID.
Implementation
@override
Future<bool> one<T>(dynamic object, { String? subcollection, GetOptions? getOptions }) async {
if (object.id == null) {
return false;
}
DocumentReference ref = FS.instance.collection(object.runtimeType.toString()).doc(object.id);
if (subcollection != null) {
ref = FS.instance.collection(object.runtimeType.toString()).doc(subcollection).collection(subcollection).doc(object.id);
}
DocumentSnapshot snapshot = await ref.get(getOptions);
return snapshot.exists;
}