select method

void select(
  1. Json? value
)

Sets the pinned selection from state: {index} or {index, mark} (the mark's place in its pane); null lets go.

Implementation

void select(Json? value) {
  GraphHit? next;
  if (value?['index'] case final num i when i >= 0 && i < count) {
    final pane = ((value?['pane'] as num?)?.toInt() ?? 0).clamp(0, spec.panes.length - 1);
    next = GraphHit(pane: pane, index: i.toInt(), mark: (value?['mark'] as num?)?.toInt());
  }
  if (next == _pinned) return;
  _pinned = next;
  notifyListeners();
}