getSelected<T extends TreeData> static method

List<TreeVO<T>> getSelected<T extends TreeData>(
  1. List<TreeVO<T>> data
)

Implementation

static List<TreeVO<T>> getSelected<T extends TreeData>(List<TreeVO<T>> data) {
  var selected = <TreeVO<T>>[];
  data.forEach((element) {
    if (element.checked!) {
      selected.add(element);
    }
    if (element.children.length > 0) {
      selected.addAll(getSelected(element.children));
    }
  });
  return selected;
}