findCellById method

PaneList findCellById(
  1. String cellId
)

Traverse via BFS

Implementation

PaneList findCellById(String cellId) {
  if (api.workspace.workspaceConfigs.panesLayout.id == cellId) {
    return api.workspace.workspaceConfigs.panesLayout;
  }
  if (api.workspace.workspaceConfigs.panesLayout is MultiplePaneList) {
    final List<PaneList> queue =
        (api.workspace.workspaceConfigs.panesLayout as MultiplePaneList)
            .value
            .toList();

    do {
      for (final item in queue) {
        if (item.id == cellId) return item;
        queue.remove(item);
        if (item is MultiplePaneList) {
          queue.addAll(item.value);
        }
      }
    } while (queue.isNotEmpty);
  }
  throw Exception('$cellId not found');
}