transitionFor method
Finds the first transition matching all the criteria, or returns null
.
This passes the criteria to Transition.matches.
event
An event name such as turnOn
.
elapsedTime
A time value, as used in time-based transitions.
context
Used to evaluate Transition.condition to see if it should
match. (If the condition is non-null and ignoreContext
is not true
)
ignoreContext
If true
, skip the Transition.condition check.
Implementation
Transition<T>? transitionFor(
{String? event,
Duration? elapsedTime,
T? context,
bool? ignoreContext = false}) =>
transitions.firstWhereOrNull((t) => t.matches(
anEvent: event,
elapsedTime: elapsedTime,
context: context,
ignoreContext: ignoreContext));