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;
if (_pendingToolApproval != null) {
_pendingToolApproval!.completer.complete(ToolApprovalDecision.deny);
_pendingToolApproval = null;
}
notifyListeners();
}
}