currentTokenStream method

Stream<Token?> currentTokenStream()

Returns a Stream that immediately emits the current stored token and then continues with every subsequent change from tokenStream.

The first emission is null if storage is empty. This combines the common "seed + subscribe" pattern into a single call:

keeper.currentTokenStream().listen((token) {
  // token: current value on subscribe, then live updates
});

Implementation

Stream<Token?> currentTokenStream() async* {
  yield await peek();
  yield* tokenStream;
}