collection method

CollectionReference<Map<String, dynamic>> collection(
  1. String collectionPath
)

Gets a CollectionReference for the specified Firestore path.

Implementation

CollectionReference<Map<String, dynamic>> collection(String collectionPath) {
  if (collectionPath.isEmpty) {
    throw ArgumentError('A collection path must be a non-empty string.');
  } else if (collectionPath.contains('//')) {
    throw ArgumentError('A collection path must not contain "//".');
  } else if (!isValidCollectionPath(collectionPath)) {
    throw ArgumentError(
      'A collection path must point to a valid collection.',
    );
  }

  return _JsonCollectionReference(this, _delegate.collection(collectionPath));
}