matches method

  1. @override
bool matches(
  1. ConditionContext context
)
override

Whether the annotated bean should be registered; context gives access to the configuration and the definitions registered so far.

Implementation

@override
bool matches(ConditionContext context) {
  bool evaluate() {
    for (final condition in conditions) {
      final matched = condition.matches(context);
      if (context is ConditionEvaluationRecorder) {
        (context as ConditionEvaluationRecorder).recordCondition(
          key,
          condition,
          matched,
        );
      }
      if (!matched) {
        return false;
      }
    }
    return true;
  }

  return context is ConditionEvaluationCache
      ? (context as ConditionEvaluationCache).evaluateOnce(key, evaluate)
      : evaluate();
}