one<T> method

Future<bool> one<T>(
  1. dynamic object, {
  2. String? subcollection,
})

Checks if a document exists in the RDB.

Implementation

Future<bool> one<T>(dynamic object, { String? subcollection }) async {
  if (object.id == null) {
    return false;
  }
  String path = RDB.constructPathForClassAndID(object.runtimeType, object.id, subcollection: subcollection);
  final snapshot = await RDB.instance.ref(path).get();
  return snapshot.exists;
}