sortDependencies method Null safety

void sortDependencies()

Sort the DAG for resolution in order of dependencies such that dependent compnents process after their dependencies.

Implementation

void sortDependencies() {
  var optimistic = DependencySorter<Component>();
  var order = optimistic.sort(this);
  if (order.isEmpty) {
    // cycle detected, use a more robust solver
    var robust = TarjansDependencySorter<Component>();
    order = robust.sort(this);
  }

  _dependencyOrder = order;
  for (final component in _dependencyOrder) {
    component.graphOrder = graphOrder++;
    // component.dirt = 255;
  }

  _dirt |= ComponentDirt.components;
}