getRootNode method

RuleNode? getRootNode(
  1. Map<String, RuleNode> nodes
)

Implementation

RuleNode? getRootNode(Map<String, RuleNode> nodes) {
  final roots = nodes.values.where((n) => n.root).toList();
  if (roots.length > 1) {
    throw Exception(
      "The root engine must not be called with more than one root node.",
    );
  }
  return roots.isNotEmpty ? roots.first : null;
}