manageSession method
Set an active DescopeSession in this manager.
You should call this function after a user finishes logging in to the host application.
The parameter is set as the value of the session property and is persisted
so it can be reloaded on the next application launch by calling the
load function.
Important: The default DescopeSessionStorage only keeps at most
one session in the storage for simplicity. If for some reason you
have multiple DescopeSessionManager objects then be aware that
unless they use custom storage objects they might overwrite
each other's saved sessions.
Implementation
void manageSession(DescopeSession session) {
final previous = _session;
_session = session;
lifecycle.session = session;
storage.saveSession(session);
if (previous?.sessionJwt != session.sessionJwt || previous?.refreshJwt != session.refreshJwt) {
_notifyTokens(session);
}
if (previous?.user != session.user) {
_notifyUser(session);
}
}