getAllInstances static method

Map<Type, dynamic> getAllInstances(
  1. ZenScope scope
)

Get all instances registered in a scope (for debugging and introspection) Returns a map of Type -> instance for easy inspection

Implementation

static Map<Type, dynamic> getAllInstances(ZenScope scope) {
  if (scope.isDisposed) {
    return <Type, dynamic>{};
  }

  final instances = <Type, dynamic>{};

  // We need to access the private members, so we'll add these as methods to ZenScope
  // For now, let's use the existing getAllDependencies method and enhance it
  final dependencies = scope.getAllDependencies();

  for (final instance in dependencies) {
    instances[instance.runtimeType] = instance;
  }

  return Map.unmodifiable(instances);
}