document method Null safety

  1. @override
Parser document()
override

Implementation

@override
Parser document() => super.document().map((each) {
      final nodes = [];
      if (each[0] != null) {
        nodes.add(each[0]); // declaration
      }
      nodes.addAll(each[1]);
      if (each[2] != null) {
        nodes.add(each[2]); // doctype
      }
      nodes.addAll(each[3]);
      nodes.add(each[4]); // document
      nodes.addAll(each[5]);
      return createDocument(nodes.cast<TNode>());
    });