ConditionalOnMissingPod constructor

const ConditionalOnMissingPod({
  1. List<Object> values = const [],
  2. List<Object> ignoredTypes = const [],
})

An annotation that activates a component only when specific pods are absent from the ConditionalContext.

This enables fallback configuration or alternative service definitions when certain pods are not registered.

Each pod may be referenced by type, qualified name, or pod name. Additionally, the ignoredTypes list can be used to exclude certain pod types from absence checks.

Example

@ConditionalOnMissingPod(
  values: [ClassType<Database>(), 'cacheService'],
  ignoredTypes: [ClassType<Logger>()],
)
class FallbackConfig {}

The above activates only if:

  • Neither Database nor a pod named cacheService exist,
  • And the Logger pod is ignored during evaluation.

Implementation

const ConditionalOnMissingPod({this.values = const [], this.ignoredTypes = const []});