setInitialSession method

Future<void> setInitialSession(
  1. String jsonStr
)

Set the initial session to the session obtained from local storage

Implementation

Future<void> setInitialSession(String jsonStr) async {
  final session = Session.fromJson(json.decode(jsonStr));
  if (session == null) {
    // sign out to delete the local storage from supabase_flutter
    await signOut();
    throw notifyException(AuthException('Initial session is missing data.'));
  }

  _currentSession = session;
  _currentUser = session.user;
  notifyAllSubscribers(AuthChangeEvent.initialSession);
}