sort function

void sort(
  1. Tree tree
)

Implementation

void sort(Tree tree) {
  tree.children.sortBy((element) => element.data.title);
  tree.children.sortBy<num>(
    (element) => switch (element.data.data) {
      ModuleNode _ => 0,
      FolderNode _ => 10,
      DocumentationNode _ => 50,
      _ => 1000,
    },
  );

  for (final child in tree.children) {
    sort(child);
  }
}