cancelGeneration method

void cancelGeneration()

Requests cancellation of the currently executing prompt/sub-prompt chain. Safe to call from any thread.

Implementation

void cancelGeneration() {
  if (_generating) {
    _cancelRequested = true;
    notifyListeners();
  }
}