TurboAuthSyncService<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
- TurboAuthSyncService.new({bool initialiseStream = true})
- Creates a new TurboAuthSyncService 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< Function(User user)StreamValue?> > -
Returns a stream of data for the authenticated user.
no setter
Methods
-
dispose(
) → Future< void> - Cleans up resources and resets the service state.
-
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(
TurboFirestoreException 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 Log 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