one<T> method

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

Checks if a document exists in the RDB.

Implementation

@override
Future<bool> one<T>(dynamic object, { String? subcollection }) async {
  final String? className = RDB.classNames[object.runtimeType];
  if (className == null) {
    throw UnsupportedError('No class name found for type: $className. Consider re-generating Firestorm data classes.');
  }
  if (object.id == null) {
    return false;
  }
  String path = RDB.constructPathForClassAndID(className, object.id, subcollection: subcollection);
  final snapshot = await RDB.instance.ref(path).get();
  return snapshot.exists;
}