findBy method
Returns first found instance of type in given scope by compare function
Implementation
T? findBy(String scope, bool Function(T) compare) {
if (!_instances.containsKey(scope)) {
return null;
}
for (final entry in _instances[scope]!.entries) {
for (final instance in entry.value) {
if (compare(instance)) {
return instance;
}
}
}
return null;
}