AuthenticatorState constructor

AuthenticatorState(
  1. StateMachineBloc _authBloc, {
  2. required DialCode defaultDialCode,
})

Implementation

AuthenticatorState(this._authBloc, {required this.defaultDialCode}) {
  // Listen to step changes to know when to clear the form. Calling `clean`
  // from the forms' dispose method is unreliable since it may be called after
  // the transitioning form's first build is called.
  //
  // When auth flow is complete, reset entirety of the view model state.
  _authBloc.stream.distinct().listen((event) {
    _resetFormKey();
    resetCode();
    if (event is AuthenticatedState) {
      _resetAttributes();
    }
  });

  // Always listen for ConfirmSignInCustom events (not distinct)
  _authBloc.stream.listen((event) {
    if (event is ConfirmSignInCustom) {
      _resetFormKey();
      publicChallengeParams = event.publicParameters;
    }
  });
}