maxDepth static method

int maxDepth({
  1. required List<PlutoColumnGroup> columnGroupList,
  2. int level = 0,
})

columnGroupList Returns the depth of how many levels the group has been set.

Implementation

static int maxDepth({
  required List<PlutoColumnGroup> columnGroupList,
  int level = 0,
}) {
  int currentDepth = level + 1;

  for (int i = 0; i < columnGroupList.length; i += 1) {
    if (columnGroupList[i].hasChildren) {
      final int depth = maxDepth(
        columnGroupList: columnGroupList[i].children!,
        level: level + 1,
      );

      if (depth > currentDepth) {
        currentDepth = depth;
      }
    }
  }

  return currentDepth;
}