deleteDocument method
Implementation
@override
FutureOr<void> deleteDocument({
String absolutePath = '',
String documentPath = '',
}) async {
assert(
absolutePath.isNotEmpty != documentPath.isNotEmpty,
'Only one parameter of absolutePath or documentPath must be used',
);
var docPath = absolutePath;
if (docPath.isEmpty) {
docPath = firestorePathUtils.absolutePathFromRelative(documentPath);
}
final collectionNames =
await _getDocumentCollectionNames(absolutePath: docPath);
for (final collectionName in collectionNames) {
final collectionPath = di<PathUtils>().join(docPath, collectionName);
await deleteCollection(absolutePath: collectionPath);
}
await firestore.delete(docPath);
}