clean method Null safety

void clean()

Implementation

void clean() {
  if (_needDependenciesBuilt.isNotEmpty) {
    // Copy it in case it is changed during the building (meaning this process
    // needs to recurse).
    Set<Component> needDependenciesBuilt =
        Set<Component>.from(_needDependenciesBuilt);
    _needDependenciesBuilt.clear();

    // First resolve the artboards
    for (final component in needDependenciesBuilt) {
      component.resolveArtboard();
    }

    // Then build the dependencies
    for (final component in needDependenciesBuilt) {
      component.buildDependencies();
    }

    sortDependencies();
    computeDrawOrder();
  }
}