print method Null safety

void print (
  1. String line
)

Prints the given line.

The global print function delegates to the current zone's print function which makes it possible to intercept printing.

Example:

import 'dart:async';

main() {
  runZoned(() {
    // Ends up printing: "Intercepted: in zone".
    print("in zone");
  }, zoneSpecification: new ZoneSpecification(
      print: (Zone self, ZoneDelegate parent, Zone zone, String line) {
    parent.print(zone, "Intercepted: $line");
  }));
}

Implementation

void print(String line);