hasAsyncDependency function Null safety

bool hasAsyncDependency(
  1. DependencyConfig dep,
  2. Set<DependencyConfig> allDeps
)

Implementation

bool hasAsyncDependency(DependencyConfig dep, Set<DependencyConfig> allDeps) {
  for (final iDep in dep.dependencies) {
    var config = lookupDependency(iDep, allDeps);

    // If the dependency corresponding to the InjectedDependency couldn't be
    // found, this probably indicates there is a missing dependency.
    if (config == null) {
      continue;
    }

    // Ultimately, this is what we're looking for:
    if (config.isAsync && !config.preResolve) {
      return true;
    }

    // If the dependency itself isn't async, check to see if any of *its*
    // dependencies are async.
    if (hasAsyncDependency(config, allDeps)) {
      return true;
    }
  }
  return false;
}