findStateDefintion method
recursively searches through the list of nested StateDefinitions
for a StateDefinition of type stateDefinitionType
;
Implementation
StateDefinition<State>? findStateDefintion(Type? stateDefinitionType,
{bool includeChildren = true}) {
StateDefinition? found;
for (final stateDefinition in childStateDefinitions) {
if (stateDefinition.stateType == stateDefinitionType) {
found = stateDefinition;
break;
} else {
if (includeChildren) {
found = stateDefinition.findStateDefintion(stateDefinitionType);
if (found != null) {
break;
}
}
}
}
return found;
}