of static method

NavNodeRole of({
  1. required int depth,
  2. required bool hasChildren,
})

Resolve a node's role from its depth and whether it hasChildren.

Implementation

static NavNodeRole of({required int depth, required bool hasChildren}) {
  if (hasChildren) return depth == 0 ? NavNodeRole.module : NavNodeRole.group;
  return depth == 0 ? NavNodeRole.direct : NavNodeRole.item;
}