findNodeWithUncompletedRule method Null safety

ParentNode? findNodeWithUncompletedRule(
  1. int ruleIndex
)

Find a ParentNode that still needs to check the given rule

Implementation

ParentNode? findNodeWithUncompletedRule(int ruleIndex) {
  if (lastCompletedRuleIndex < ruleIndex) {
    return this;
  }
  for (Node child in children) {
    if (child is ParentNode) {
      var found = child.findNodeWithUncompletedRule(ruleIndex);
      if (found != null) return found;
    }
  }
  return null;
}