doc method

DocumentReference<T> doc([
  1. String? documentPath
])

Returns a DocumentReference to the document at documentPath within this collection, or to a new document with an auto-generated ID when no path is given.

Implementation

DocumentReference<T> doc([String? documentPath]) {
  if (documentPath != null) {
    checkNonEmptyPath('CollectionReference.doc', documentPath);
  }
  return DocumentReference<T>.forPath(
    query.path.appendField(ResourcePath.fromString(documentPath ?? autoId())),
    firestore,
    converter,
  );
}