writeNode method Null safety

void writeNode(
  1. String label,
  2. TreeNode? node
)

Implementation

void writeNode(String label, TreeNode? node) {
  write('$label: ');
  depth += 1;
  if (node != null) {
    node.visit(printer!);
  } else {
    writeln('null');
  }
  depth -= 1;
}