collection method

CollectionReference<Map<String, dynamic>> collection(
  1. Type type, {
  2. String? subcollection,
})

Returns a reference to a collection using its class.

Implementation

CollectionReference<Map<String, dynamic>> collection(Type type, { String? subcollection }) {
  final String? className = FS.classNames[type];
  if (className == null) {
    throw UnsupportedError('No class name found for type: $className. Consider re-generating Firestorm data classes.');
  }
  if (subcollection != null) {
    return FS.instance.collection(className).doc(subcollection).collection(subcollection);
  }
  return FS.instance.collection(className);
}