getPodsOf<T> method

  1. @override
Future<Map<String, T>> getPodsOf<T>(
  1. Class<T> type, {
  2. bool includeNonSingletons = false,
  3. bool allowEagerInit = false,
})

Retrieves all pods of the specified type as a map of name to instance.

This method provides a convenient way to get all pods of a type along with their registered names.

Usage Example:

final services = await factory.getPodsOf<Service>(
  Class<Service>(),
  includeNonSingletons: false, // Only singletons
);

for (final entry in services.entries) {
  print('Service ${entry.key}: ${entry.value}');
}

@param type The type of pods to find @param includeNonSingletons Whether to include non-singleton pods @param allowEagerInit Whether to allow eager initialization during lookup @return A Future that completes with a map of pod names to instances

Implementation

@override
Future<Map<String, T>> getPodsOf<T>(Class<T> type, {bool includeNonSingletons = false, bool allowEagerInit = false}) async {
  Map<String, T> map = Map<String, T>.from(await getPodFactory().getPodsOf(type, includeNonSingletons: includeNonSingletons, allowEagerInit: allowEagerInit));

  if (_parent != null) {
    map.addAll(await _parent!.getPodFactory().getPodsOf(type, includeNonSingletons: includeNonSingletons, allowEagerInit: allowEagerInit));
  }

  return map;
}