delete method
Implementation
Future<void> delete(Model model) async {
emit(state.copyWith(isDeleting: true, isError: false));
try {
await documentProvider.deletePage(model: model, documentId: state.data[model.idField.id].toString());
await _deleteDraft();
modelId = null;
documentId = null;
emit(state.copyWith(isDeleting: false));
eventBus.send(eventId: DocumentEvent.documentChanged, request: model);
} catch (error) {
emit(state.copyWith(isDeleting: false));
throw error.toHumanException('Page deletion failed!');
}
}