selectedLastColumnList method

List<TSelectionEntity> selectedLastColumnList()

Implementation

List<TSelectionEntity> selectedLastColumnList() {
  List<TSelectionEntity> list = [];
  if (children.isNotEmpty) {
    List<TSelectionEntity> firstList = [];
    for (TSelectionEntity firstEntity in children) {
      if (firstEntity.children.isNotEmpty) {
        List<TSelectionEntity> secondList = [];
        for (TSelectionEntity secondEntity in firstEntity.children) {
          if (secondEntity.children.isNotEmpty) {
            List<TSelectionEntity> thirds =
              SelectionUtil.currentSelectListForEntity(secondEntity);
            if (thirds.isNotEmpty) {
              list.addAll(thirds);
            } else if (secondEntity.isSelected) {
              secondList.add(secondEntity);
            }
          } else if (secondEntity.isSelected) {
            secondList.add(secondEntity);
          }
        }
        list.addAll(secondList);
      } else if (firstEntity.isSelected) {
        firstList.add(firstEntity);
      }
    }
    list.addAll(firstList);
  }
  return list;
}