setAuthStateListener method
Set a block to be invoked every time SDK authorization state changes. Important:
- Hosting app must handle case
invalid
by shutting down SDK as SDK cannot refresh the token anymore. Returns stream: latest MoveAuthState. Invoked every time auth state changes.
Implementation
@override
Stream<MoveAuthState> setAuthStateListener() async* {
yield* authStateChannel
.receiveBroadcastStream()
.asyncMap<MoveAuthState>((authState) {
MoveAuthState? result = MoveAuthState.values.firstWhereOrNull(
(element) => element.name.toLowerCase() == authState.toLowerCase());
return result ?? MoveAuthState.unknown;
});
}