initializeState method

void initializeState({
  1. required User? fbUser,
  2. AuthUserProfile? profile,
  3. bool resetState = false,
})

Most of the time, setting these variables should be handled automatically, and this method should not be needed.

Implementation

void initializeState(
    {required fb.User? fbUser,
    AuthUserProfile? profile,
    bool resetState = false}) {
  if (resetState) {
    // This will not fire any events, but will ensure that the next change is propagated.
    _currentUserProfile = null;
    _currentFbUser = null;
  }
  _authStateClearinghouse
      .add(AuthEvent(fbUser, source: AuthEventSource.initial));
  if (profile != null) {
    userStateChangedStream.current = profile;
  }
}