cancelGeneration method

  1. @override
void cancelGeneration()
override

Implementation

@override
void cancelGeneration() {
  // A turn still waiting for the one before it hears of this and does not
  // start.
  _stopEpoch++;
  // Only a cancel that lands inside a turn damages the conversation. The
  // turn's `finally` turns this into a recovery if generation had begun.
  if (_inFlight) _stopRequested = true;
  // The turn returns after the recovery instead of generating.
  if (_recovering) return;
  _live.cancelGeneration();
}