oneWithID<T> method

  1. @override
Future<bool> oneWithID<T>(
  1. Type type,
  2. String documentID, {
  3. String? subcollection,
})
override

Checks if a document exists in the RDB using its type and ID.

Implementation

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