runWithConsoleMarkdownSync<T> function
Synchronous variant of runWithConsoleMarkdown for tools that don't need async (rarely used — prefer the async version).
Implementation
T runWithConsoleMarkdownSync<T>(
T Function() body, {
void Function(Object error, StackTrace stack)? onError,
}) {
if (isConsoleMarkdownActive) {
return body();
}
return runZoned(
body,
zoneSpecification: ZoneSpecification(
print: (Zone self, ZoneDelegate parent, Zone zone, String line) {
parent.print(zone, line.toConsole());
},
),
zoneValues: {kConsoleMarkdownZoneKey: true},
);
}