close method

  1. @override
Future<void> close()
override

Ends the conversation. Natively it may complete before the native delete, which waits for an operation still running on the conversation; on the web it completes once the generation has drained and the runtime conversation is deleted. Idempotent: a second call does not close twice.

Implementation

@override
Future<void> close() async {
  if (_closed) return;
  _closed = true;
  _history.clear();
  // The native handle waits for an operation still running on it (a rewind,
  // a generation) before it deletes the conversation.
  _live.close();
}