lookupDependencyWithNoEnvOrHasAny function
DependencyConfig?
lookupDependencyWithNoEnvOrHasAny(
- InjectedDependency iDep,
- List<
DependencyConfig> allDeps, - List<
String> envs
Resolves a DartType to an ImportableType, which includes information about the type's name, nullability,
and required imports. Optionally takes an ExecutableElement to provide additional context for resolving the function type.
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(envs.contains)),
);
}