sort method

T sort(
  1. int compare(
    1. T,
    2. T
    ), [
  2. bool iterator = true
])

Implementation

T sort(int Function(T, T) compare, [bool iterator = true]) {
  if (iterator) {
    return eachBefore((T node, b, c) {
      if (node.hasChild) {
        node._childrenList.sort(compare);
      }
      return false;
    });
  }
  _childrenList.sort(compare);
  return this as T;
}