Open torbenkeller opened 1 year ago
Hi @torbenkeller - This sounds like a reasonable request. The react Authenticator does expose some ability to access the state. The flutter authenticator does not have this ability.
In addition to the suggestions above, another option would be to expose AuthenticatorState outside of the authenticatorBuilder
method. This is intended to be the publicly exposed representation of the internal state. Since it is intended only to be used in an unauthenticated state, it does not currently expose all of the info you might want to access for your use case. An inherited widget for this exists, but it is not exposed.
I will mark this as a feature request so that we can track interest in this.
Hi @Jordan-Nelson - unfortunately AuthenticatorState
is not exposing the AuthState
@torbenkeller - Correct. If AuthenticatorState were exposed for broader use than the original intended purpose, we would need to reconsider what is included in the AuthenticatorState API.
I want to hide just a section of the page when the user is not logged in and display a button to open the authentication flow. Unfortunately it is not possible to access the current
AuthState
outside of the authenticator forms, so in the section I can not wrap the layouts depending on the currentAuthState
. Possible solutions would be:export
InheritedAuthBloc
This would be my preferred solution because it provides a stream ofAuthState
that could also be used to automatically redirect usingGoRouter.refreshListenable
.create
InheritedAuthState
This would make the currentAuthState
accessible inside custom components but keep the use cases pretty limited to that.