doc method
Gets a DocumentReference
for the specified Firestore path.
Implementation
@override
DocumentReference<Map<String, dynamic>> doc(String path) {
final segments = path.split('/');
// The actual behavior of Firestore for an invalid number of segments
// differs by platforms. This library imitates it with assert.
// https://github.com/atn832/fake_cloud_firestore/issues/30
assert(segments.length % 2 == 0,
'Invalid document reference. Document references must have an even number of segments');
final documentId = segments.last;
return MockDocumentReference(
this,
path,
documentId,
getSubpath(_root, path),
_docsData,
_root,
getSubpath(_snapshotStreamControllerRoot, path),
null);
}