find<InstanceType> method

InstanceType? find<InstanceType>(
  1. String scope
)

Returns first found instance of type in given scope

Implementation

InstanceType? find<InstanceType>(String scope) {
  if (!_instances.containsKey(scope)) {
    return null;
  }

  for (final entry in _instances[scope]!.entries) {
    for (final instance in entry.value) {
      if (instance is InstanceType) {
        return instance;
      }
    }
  }

  return null;
}