lookupDependencyWithNoEnvOrHasAny function

DependencyConfig? lookupDependencyWithNoEnvOrHasAny(
  1. InjectedDependency iDep,
  2. List<DependencyConfig> allDeps,
  3. List<String> envs
)

Implementation

DependencyConfig? lookupDependencyWithNoEnvOrHasAny(
  InjectedDependency iDep,
  List<DependencyConfig> allDeps,
  List<String> envs,
) {
  return allDeps.firstWhereOrNull(
    (d) =>
        d.type == iDep.type &&
        d.instanceName == iDep.instanceName &&
        (d.environments.isEmpty ||
            envs.isEmpty ||
            d.environments.any(
              (e) => envs.contains(e),
            )),
  );
}