getSelectedIndices method

List<int> getSelectedIndices({
  1. int? fallbackIndex,
})

Gets the selected indices as a sorted list.

If nothing is selected and fallbackIndex is provided, returns a list with just that index.

Implementation

List<int> getSelectedIndices({int? fallbackIndex}) {
  if (_selected.isEmpty) {
    if (fallbackIndex != null) {
      return [fallbackIndex];
    }
    return [];
  }
  return _selected.toList()..sort();
}