saveSession method

  1. @override
Future<void> saveSession(
  1. DescopeSession session
)
override

Called by the session manager when a new DescopeSession is set or an existing session is updated.

Implementation

@override
Future<void> saveSession(DescopeSession session) async {
  final value = _Value(session.sessionJwt, session.refreshJwt, session.user);
  if (value != _lastValue) {
    final json = jsonEncode(_Value.toJson(value));
    _store.saveItem(key: _projectId, data: json);
    _lastValue = value;
  }
}