flattenForks function

List<List> flattenForks(
  1. List t
)

Implementation

List<List> flattenForks(List t) {
  switch (t[0]) {
    case NodeId.Empty:
      return [];
    case NodeId.Fork:
      var res = flattenForks(t[1] as List);
      res.addAll(flattenForks(t[2] as List));
      return res;
    default:
      return [t];
  }
}