IdentityService class

Inheritance

Constructors

IdentityService(IdentityProvider provider)

Properties

hashCode int
The hash code for this object.
no setterinherited
id String
id is used to uniquely identify multiple instances of the same HydratedBloc type. In most cases it is not necessary; however, if you wish to intentionally have multiple instances of the same HydratedBloc, then you must override id and return a unique identifier for each HydratedBloc instance in order to keep the caches independent of each other.
no setterinherited
intializedProvider Future<IdentityProvider>
Returns and initialized instance of the provider for this service.
no setterinherited
isClosed bool
Whether the bloc is closed.
no setterinherited
provider IdentityProvider
Returns a provider that does not require initialization.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state IdentityState
The current state.
no setterinherited
storagePrefix String
Storage prefix which can be overridden to provide a custom storage namespace. Defaults to runtimeType but should be overridden in cases where stored data should be resilient to obfuscation or persist between debug/release builds.
no setterinherited
storageToken String
storageToken is used as registration token for hydrated storage. Composed of storagePrefix and id.
no setterinherited
stream Stream<IdentityState>
The current stream of states.
no setterinherited

Methods

addError(Object error, [StackTrace? stackTrace]) → void
Reports an error which triggers onError with an optional StackTrace.
inherited
addStateMessage(Message message) → void
Removes the given message from the state
inherited
cancelTOTPSetup() → dynamic
Cancels the TOTP setup
clear() Future<void>
clear is used to wipe or invalidate the cache of a HydratedBloc. Calling clear will delete the cached state of the bloc but will not modify the current state of the bloc.
inherited
clearAwaitingVerification() Future<void>
Clear verification state
close() Future<void>
Closes the instance. This method should be called when the instance is no longer needed. Once close is called, the instance can no longer be used.
confirmSignUpCode(String username, String code) Future<void>
Confirm the registration of a particular username with the given code
confirmVerificationCode(String attribute, String code) Future<void>
Confirms the given attribute with the given code
emit(IdentityState state) → void
Updates the state to the provided state. emit does nothing if the state being emitted is equal to the current state.
inherited
ensureLoadingFinished(LoadingState loadingState) Future<void>
This method should be called when you want to wait for a particular loading state to finish.
inherited
ensureLoadingStarted(LoadingState loadingState) Future<void>
This method should be called when you want to wait for a particular loading state to start.
inherited
fromJson(Map<String, dynamic> json) IdentityState?
Responsible for converting the Map<String, dynamic> representation of the bloc state into a concrete instance of the bloc state.
hydrate() → void
Populates the internal state storage with the latest state. This should be called when using the HydratedMixin directly within the constructor body.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onChange(Change<IdentityState> change) → void
Called whenever a change occurs with the given change. A change occurs when a new state is emitted. onChange is called before the state of the cubit is updated. onChange is a great spot to add logging/analytics for a specific cubit.
inherited
onError(Object error, StackTrace stackTrace) → void
Called whenever an error occurs and notifies BlocObserver.onError.
inherited
removeStateMessage(Message message) → void
Removes the given message from the state
inherited
resendSignUpCode(String username) Future<void>
Resend sign-up code to the given username for verification
resetPassword(String username) Future<void>
Initiates a password reset flow for the given username
saveUser(User user) Future<void>
Saves the given user attributes to the backend
sendVerificationCode(String attribute) Future<void>
Sends a verification code to verify the given attribute
setCurrentContext(BuildContext context) → void
This method is called by from the top level of the widget tree to initialize the service's localizations so it can be applied throughout the service regardless of whether if the context is available. This method should return either itself initialized with the context or a new instance of the Service initialized with the context. This is a convenience method that allows the service to be initialized with the context without having to create a new instance and is called by the Feature class when creating BLoC providers for the service.
override
setProfilePictureUrl(User user) User
setupTOTP({String? appName}) Future<void>
Sets up TOTP for the logged in user
signIn(String username, String password) Future<void>
Signs in the given username with the given password
signOut() Future<void>
Signs out the logged in user
signUp(User user, String password) Future<void>
Signs in the user with the given username and password
toJson(IdentityState state) Map<String, dynamic>?
Responsible for converting a concrete instance of the bloc state into the the Map<String, dynamic> representation.
toString() String
A string representation of this object.
inherited
touchSession() → void
Updates the session timeout
updatePassword(String username, String password, String code) Future<void>
Updates the given username's password validating the change with the given code
updateUserInState(User user) → void
Updates user instance in state
validateMFACode(String code) Future<void>
Validates the given multi-factor authentication code
validateSession() Future<void>
verifyTOTP(String code) Future<void>
Verifies the TOTP setup with the given code

Operators

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