AuthState class

Authentication state container

Constructors

AuthState({AuthStatus status = AuthStatus.unknown, AuthUser? user, String? error})
const
AuthState.authenticated(AuthUser authenticatedUser)
Create an authenticated state
AuthState.loading()
Create a loading state
const
AuthState.unauthenticated()
Create an unauthenticated state
const
AuthState.withError(String errorMessage)
Create an error state

Properties

error String?
Error message if status is error
final
hasError bool
Whether there is an error
no setter
hashCode int
The hash code for this object.
no setterinherited
isAuthenticated bool
Whether the user is authenticated
no setter
isLoading bool
Whether authentication is in progress
no setter
isUnknown bool
Whether the state is unknown (initial)
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
status AuthStatus
Current authentication status
final
user AuthUser?
Current authenticated user (null if not authenticated)
final

Methods

copyWith({AuthStatus? status, AuthUser? user, String? error}) AuthState
Create a copy with updated fields
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited