loadSession method
Loads any saved DescopeSession from secure storage.
This function should be called once after initializing the Descope SDK
with your projectId and other configurations. It will load any saved
DescopeSession into memory.
This asynchronous function should be called when initializing your application state to restore the logged in state of the user.
Important: It might be convenient to call this in your main() function,
in which case be sure to call WidgetsFlutterBinding.ensureInitialized()
beforehand:
void main() async {
WidgetsFlutterBinding.ensureInitialized();
Descope.setup('...');
await Descope.sessionManager.loadSession();
...
}
Implementation
Future<void> loadSession() async {
_session = await storage.loadSession();
lifecycle.session = _session;
}