claimDriver method

void claimDriver(
  1. Object driver
)

Claim exclusive drive. Refuses (with the fix) when another driver holds it; re-claiming by the same driver is a no-op.

Implementation

void claimDriver(Object driver) {
  var current = _driver;
  if (current != null && !identical(current, driver)) {
    throw StateError(
      'this playable is already driven by another player — one driver at '
      'a time (two would double-write every frame); stop the other '
      'player first',
    );
  }
  _driver = driver;
}