testPrintOutput function
Used for testing the output of a callback that's printed in the console.
Implementation
@visibleForTesting
String testPrintOutput(final Function callback) {
String printedText = '';
runZoned(
() => callback(),
zoneSpecification: ZoneSpecification(
print: (_, __, ___, String line) {
printedText = line;
},
),
);
return printedText;
}