17 lines
367 B
Dart
17 lines
367 B
Dart
import 'dart:async';
|
|
|
|
void Function() overridePrint(void Function(List<String> logs) fn) {
|
|
return () {
|
|
final printLogs = <String>[];
|
|
final spec = ZoneSpecification(
|
|
print: (_, __, ___, String msg) {
|
|
printLogs.add(msg);
|
|
},
|
|
);
|
|
|
|
return Zone.current
|
|
.fork(specification: spec)
|
|
.run<void>(() => fn(printLogs));
|
|
};
|
|
}
|