capturePrint function Null safety

void capturePrint(
  1. void body(
      )
    )

    Captures calls to print in the body and forwards them to writeln.

    Implementation

    void capturePrint(void Function() body) {
      runZoned(body, zoneSpecification: ZoneSpecification(print: (s, p, z, arg) {
        writeln(arg);
      }));
    }