queryMenuNodeByPath method

MenuNode? queryMenuNodeByPath(
  1. MenuNode node,
  2. String path
)

Implementation

MenuNode? queryMenuNodeByPath(MenuNode node, String path) {
  if (node.path == path) {
    return node;
  }
  if (node.children.isNotEmpty) {
    for (int i = 0; i < node.children.length; i++) {
      MenuNode? result = queryMenuNodeByPath(node.children[i], path);
      if (result != null) {
        return result;
      }
    }
  }
  return null;
}