doc method
Returns a DocumentReference to the document at documentPath.
documentPath is a slash-separated path from the root of the database with an even number of segments, such
as cities/SF or cities/SF/landmarks/bridge. Throws an ArgumentError if it is empty or names a collection
(an odd number of segments).
Creating a reference does not contact the backend, and the document does not need to exist.
final DocumentReference<Map<String, Object?>> sf = firestore.doc(
'cities/SF',
);
await sf.set({'name': 'San Francisco', 'population': 870000});
Implementation
DocumentReference<Map<String, Object?>> doc(String documentPath) {
checkNotNull(documentPath, 'Provided document path must not be null.');
checkNonEmptyPath('Firestore.doc', documentPath);
return DocumentReferenceInternal.forPath(
ResourcePath.fromString(documentPath),
this,
);
}