terminalOf method
The RETAINED terminal of the named session — the exact
RuntimeEvent.exited/RuntimeEvent.died this provider emitted for it,
inferred flag and reason intact — or null while the session is live,
unknown, or released.
A terminal is STATE, not just an instant on events (tg-uad): the provider latches it BEFORE emitting, so a consumer that subscribed after the emission (or whose emission fired with zero listeners on the unbuffered broadcast stream) can still query the outcome. The live path stays push (events); this held record is the state half of the standard state-then-stream pattern — consult terminalOf first, then subscribe.
RELEASE semantics (deliberate; part of this contract):
- a new start of the same name CLEARS the prior incarnation's stale terminal — the name is reborn, and an old outcome must never shadow the new incarnation;
- stop of the name RELEASES it (the teardown / lease-release path: a stopped session is silent by design AND holds no terminal);
- provider teardown (dispose/close) releases all held terminals.
Implementation
@override
RuntimeEvent? terminalOf(String name) => _terminals[name];