lookupDependency function Null safety

DependencyConfig? lookupDependency(
  1. InjectedDependency iDep,
  2. Set<DependencyConfig> allDeps
)

Implementation

DependencyConfig? lookupDependency(
    InjectedDependency iDep, Set<DependencyConfig> allDeps) {
  try {
    return allDeps.firstWhere(
        (d) => d.type == iDep.type && d.instanceName == iDep.instanceName);
  } on StateError {}
  return null;
}