anchor.diff:        _setSelection(rowIndex);
       }
     }
  -  
  +
     void _toggleSelectedRow(int rowIndex) {
       _removeCurrentSelectionHighlight();
   
       _selectedRow = rowIndex;
  -    
  +
       if (_selection.contains(rowIndex)) {
         _selection.remove(rowIndex);
       } else {
         _selection.add(rowIndex);
       }
  -    
  +
       _addCurrentSelectionHighlight();
       _delegate.listViewSelectedChanged(this, _selection.toList());
     }
  -  
  +
     void _setSelection(int selectionIndex, {int endSelectionIndex: -1}) {
       _removeCurrentSelectionHighlight();
  -    
  +
       // If endSelection is -1 (default for not-provided), one item is being selected.
       if (endSelectionIndex == -1) {
         endSelectionIndex = selectionIndex;
       }
  -    
  +
  +    selectionIndex = selectionIndex.clamp(0, _rows.length);
  +    endSelectionIndex = endSelectionIndex.clamp(0, _rows.length);
  +
       if (selectionIndex < endSelectionIndex) {
         _selection.clear();
         for(int i = selectionIndex ; i <= endSelectionIndex ; i++) {
  
positive.code:         _selection.add(i);
        }
      }
      
      _selectedRow = selectionIndex;
      
      _addCurrentSelectionHighlight();
      _delegate.listViewSelectedChanged(this, _selection.toList());
    }
  
negative.code:     _rows = [];
      _selectedRow = -1;
      _container.onClick.listen((event) {
        _removeCurrentSelectionHighlight();
        _selection.clear();
        _delegate.listViewSelectedChanged(this, _selection.toList());
  