getSelectedValues method

  1. @override
List<T> getSelectedValues()
override

Implementation

@override
List<T> getSelectedValues() {
  List<T> _items = [];
  var _sLen = picker!.selecteds.length;
  if (isArray) {
    for (int i = 0; i < _sLen; i++) {
      int j = picker!.selecteds[i];
      if (j < 0 || data[i].children == null || j >= data[i].children!.length)
        break;
      _items.add(data[i].children![j].value!);
    }
  } else {
    List<PickerItem<dynamic>>? datas = data;
    for (int i = 0; i < _sLen; i++) {
      int j = picker!.selecteds[i];
      if (j < 0 || j >= datas!.length) break;
      _items.add(datas[j].value);
      datas = datas[j].children;
      if (datas == null || datas.length == 0) break;
    }
  }
  return _items;
}