stashState method

Future<({int bytes, int tokens})> stashState(
  1. String key, {
  2. int sequenceId = 0,
})

Copies one sequence's KV state into a native, in-memory stash under key — the fast path for swapping conversations: no disk write and no bytes crossing the platform channel.

Resolves to the stash's token and byte counts; (0, 0) when the sequence held nothing reusable (nothing is stashed). The stash lives and dies with the session. An existing entry under key is replaced.

Implementation

Future<({int tokens, int bytes})> stashState(
  String key, {
  int sequenceId = 0,
}) => _isolate.stashState(id, sequenceId, key);