containsBy method

bool containsBy(
  1. String scopeId,
  2. bool compare(
    1. T
    )
)

Checks if container contains object for type in given scope by compare function

Implementation

bool containsBy(String scopeId, bool Function(T) compare) {
  if (!_instances.containsKey(scopeId)) {
    return false;
  }

  for (final entry in _instances[scopeId]!.entries) {
    for (final instance in entry.value) {
      if (compare(instance)) {
        return true;
      }
    }
  }

  return false;
}