matches method

  1. @override
bool matches({
  1. String? anEvent,
  2. Duration? elapsedTime,
  3. T? context,
  4. dynamic ignoreContext = false,
})
override

Tests whether this transition matches based on event and/or condition, ignoring elapsedTime.

anEvent The name of the event to match. If none is specified, it could still match on condition. elapsedTime Ignored. context The data tested by the condition and modified by State.onEntry and State.onExit. ignoreContext If true, skip the condition check (forces it to be true).

Implementation

@override
bool matches(
    {String? anEvent,
    Duration? elapsedTime,
    T? context,
    ignoreContext = false}) {
  // using compareTo instead of == as null safety appears to break == between
  // String? and String
  final found = anEvent != null &&
      event.compareTo(anEvent) == 0 &&
      (ignoreContext || meetsCondition(context));
  _log.finest(() => 'Matching on event $anEvent: $found');
  return found;
}