In the flutter_bloc - Login✨ tutorial the AuthentificationRepository streams an Authentification status like so :
Stream<AuthenticationStatus> get status async* {
await Future<void>.delayed(const Duration(seconds: 1));
yield AuthenticationStatus.unauthenticated;
yield* _controller.stream;
}
In my real app with a back-end I'd like to also Stream the AuthentificationStatus in order to re-route the user out if his session is no longer valid
How would this implementation look like inside a real app ?
Would I have to query my API every second to implement a similar stream ?
I'm open to suggestion to implementing this re-routing behavior & streaming the AuthentificationStatus