doc method
Gets a DocumentReference instance that refers to the document at the specified path.
documentPath
: A slash-separated path to a document.
Returns The DocumentReference instance.
final documentRef = firestore.doc('collection/document');
print('Path of document is ${documentRef.path}');
Implementation
DocumentReference<DocumentData> doc(String documentPath) {
_validateResourcePath('documentPath', documentPath);
final path = _ResourcePath.empty._append(documentPath);
if (!path.isDocument) {
throw ArgumentError.value(
documentPath,
'documentPath',
'Value for argument "documentPath" must point to a document, but was "$documentPath". '
'Your path does not contain an even number of components.',
);
}
return DocumentReference._(
firestore: this,
path: path._toQualifiedResourcePath(app.projectId, _databaseId),
converter: _jsonConverter,
);
}