Skip to content

Commit 8da1d91

Browse files
authored
Allow DartDoc to execute a callback after generateDocs (#2238)
1 parent 9895a8e commit 8da1d91

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/dartdoc.dart

+10-2
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,12 @@ class Dartdoc {
462462
}
463463

464464
/// Runs [generateDocs] function and properly handles the errors.
465-
void executeGuarded() {
465+
///
466+
/// Passing in a [postProcessCallback] to do additional processing after
467+
/// the documentation is generated.
468+
void executeGuarded([
469+
Future<void> Function(DartdocOptionContext) postProcessCallback,
470+
]) {
466471
onCheckProgress.listen(logProgress);
467472
// This function should *never* await `runZonedGuarded` because the errors
468473
// thrown in generateDocs are uncaught. We want this because uncaught errors
@@ -473,7 +478,10 @@ class Dartdoc {
473478
// never await `runZonedGuarded` and never change the return value of
474479
// [executeGuarded].
475480
runZonedGuarded(
476-
generateDocs,
481+
() async {
482+
await generateDocs();
483+
await postProcessCallback?.call(config);
484+
},
477485
(e, chain) {
478486
if (e is DartdocFailure) {
479487
stderr.writeln('\ndartdoc failed: ${e}.');

0 commit comments

Comments
 (0)