stopGeneration method
Stops the in-flight generation both locally (closes the Dart stream)
and upstream (calls conversation.cancel() per the @litert-lm/core JS
API). The cancel call is wrapped in try/catch because the early-preview
API may throw if no generation is in flight.
Implementation
@override
Future<void> stopGeneration() async {
_isCancelled = true;
try {
conversation.cancel();
} catch (e) {
if (kDebugMode) {
debugPrint('[LiteRtLmWebSession] conversation.cancel() threw: $e');
}
}
}