TAuthSyncService<StreamValue> class abstract

A service that synchronizes data with Firebase Authentication state changes.

Provides automatic data synchronization based on user authentication state:

  • Starts streaming data when a user signs in
  • Clears data when user signs out
  • Handles stream errors with automatic retries
  • Manages stream lifecycle

Type Parameters:

  • StreamValue - The type of data being streamed
Mixed-in types
Implementers

Constructors

TAuthSyncService({bool initialiseStream = true})
Creates a new TAuthSyncService instance.

Properties

cachedUserId String?
The ID of the currently authenticated user.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
onAuth FutureOr<void> Function(User user)?
Called when a user is authenticated.
getter/setter pair
onData Future<void> Function(StreamValue? value, User? user)
Handles data updates from the stream.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stream FutureOr<Stream<StreamValue?>> Function(User user)
Returns a stream of data for the authenticated user.
no setter

Methods

dispose() Future<void>
Cleans up resources and resets the service state.
getCustomClaim<T>(String key, {T? defaultValue}) → T?
Returns a specific custom claim by key.
getCustomClaims() Map<String, dynamic>?
Returns all custom claims from the cached token.
getTokenResult() Future<IdTokenResult?>
Returns the cached token result with claims.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onDone(int nrOfRetry, int maxNrOfRetry) → void
Called when the stream is done.
onError(TFirestoreException error) → void
Called when a stream error occurs.
resetAndTryInitialiseStream() Future<void>
Resets and reinitialized the stream.
toString() String
A string representation of this object.
inherited
tryHandleFirebaseAuthException<T>({required FirebaseAuthException firebaseAuthException, required TLog log}) → TurboResponse<T>
Handles Firebase Authentication exceptions and converts them to TurboResponse.
inherited
tryInitialiseStream() Future<void>
Initializes the authentication state stream and data synchronization.

Operators

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