doc method

DocumentReference doc([
  1. String? path
])

Returns a DocumentReference with the provided path.

If no path is provided, an auto-generated ID is used.

The unique key generated is prefixed with a client-generated timestamp so that the resulting list will be chronologically-sorted.

Implementation

DocumentReference doc([String? path]) {
  if (path != null) {
    assert(path.isNotEmpty, 'a document path must be a non-empty string');
    assert(!path.contains('//'), 'a document path must not contain "//"');
    assert(path != '/', 'a document path must point to a valid document');
  }

  return DocumentReference._(firestore, _delegate.doc(path));
}