flattenForks function

List<List> flattenForks(
  1. List t
)

Implementation

List<List> flattenForks(List t) {
  final NodeId nodeId = NodeId.fromValue(t[0]);
  switch (nodeId) {
    case NodeId.empty:
      return [];
    case NodeId.fork:
      final res = flattenForks(t[1] as List);
      res.addAll(flattenForks(t[2] as List));
      return res;
    default:
      return [t];
  }
}