parent property
DocumentReference<Map<String, Object?> > ?
get
parent
Gets a DocumentReference to the document that contains this collection. Only subcollections are contained in a document. For root collections, returns null.
Returns the DocumentReference that contains this collection or null if this is a root collection.
Implementation
DocumentReference<Map<String, Object?>>? get parent {
final ResourcePath parentPath = query.path.popLast();
if (parentPath.isEmpty) {
return null;
} else {
return DocumentReferenceInternal.create<Map<String, Object?>>(
DocumentKey.fromPath(parentPath),
firestore,
);
}
}