followIdentity method

void followIdentity(
  1. Stream<Object?> changes
)

Checks identity again on every event of changes — an auth state or token stream — so the saved answers are dropped as soon as someone signs out or a different identity signs in. Replaces any stream followed before.

Implementation

void followIdentity(Stream<Object?> changes) {
  unawaited(_following?.cancel());
  _following = changes.listen((_) => unawaited(_currentGeneration()));
}