getPodsWithAnnotation<A> method

  1. @override
Future<Map<String, Object>> getPodsWithAnnotation<A>(
  1. Class<A> type
)

Retrieves pods with the specified annotation as a map of name to instance.

Similar to getPodNamesForAnnotation but returns the actual instances.

Usage Example:

final scheduledPods = await factory.getPodsWithAnnotation(Class<Scheduled>());

for (final entry in scheduledPods.entries) {
  final pod = entry.value;
  if (pod is ScheduledTask) {
    await pod.schedule();
  }
}

@param type The annotation type to look for @return A Future that completes with a map of pod names to instances

Implementation

@override
Future<Map<String, Object>> getPodsWithAnnotation<A>(Class<A> type) async {
  Map<String, Object> map = Map<String, Object>.from(await getPodFactory().getPodsWithAnnotation(type));

  if (_parent != null) {
    map.addAll(await _parent!.getPodFactory().getPodsWithAnnotation(type));
  }

  return map;
}