NativeTurnStream<C extends Object> class

The stream of one native send, fed by the native callbacks.

  • A chunk that arrives after a stop was asked for repeats the cancel: a cancel only reaches the tasks that exist when it is made, so one that lands between a prefill and its decode would otherwise be lost.
  • A cancelled end that nobody asked for is an error (LiteRtLmTurnCancelledException), never a clean end: it means the conversation is poisoned.
  • A cancelled end caused by closing the session or model, before anyone asked to stop, is a LiteRtLmTurnClosedException (a StateError): the reply is incomplete.
  • A consumer that cancels its subscription asks native to stop and waits for native's end, up to consumerCancelWait; the operation itself keeps running to its end either way.

Constructors

NativeTurnStream(NativeTurns<C> _turns, C _conversation, {Duration consumerCancelWait = const Duration(seconds: 2), bool nativeStartPending = false})

Properties

consumerCancelWait → Duration
final
hashCode → int
The hash code for this object.
no setterinherited
onCancelTimeout ↔ void Function(Object error)?
Called when a cancelled native operation has not ended by the deadline. The owner uses this to reject operations queued behind the stuck turn.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stream → Stream<String>
no setter
turn → NativeTurn
final

Methods

cancelled() → void
chunk(String text) → void
failed(Object error) → void
finished() → void
nativeEntered() → void
See NativeTurns.nativeEntered.
nativeReturned() → void
See NativeTurns.nativeReturned.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited