toggleSelection method

bool toggleSelection(
  1. String id
)

Adds or removes id from the current selection.

Implementation

bool toggleSelection(String id) {
  if (objectById(id) == null) return false;
  if (_selectedObjectIds.contains(id)) {
    _selectedObjectIds.remove(id);
  } else {
    _selectedObjectIds.add(id);
  }
  render();
  _emitSelect();
  return true;
}