BeAfSyncTurboDocumentService<T extends TurboWriteableId<String> , API extends TurboFirestoreApi<T> > class
abstract
A document service that allows notification both before and after synchronizing data.
Extends TurboDocumentService to provide hooks for notifying both before and after the local state is updated with new data from Firestore.
Type Parameters:
T
- The document type, must extend TurboWriteableId<String>API
- The Firestore API type, must extend TurboFirestoreApi<T>
- Inheritance
-
- Object
- TurboAuthSyncService<
T?> - TurboDocumentService<
T, API> - BeAfSyncTurboDocumentService
Constructors
- BeAfSyncTurboDocumentService.new({required API api})
- Creates a new BeAfSyncTurboDocumentService instance.
Properties
-
afterLocalNotifyUpdate
↔ ValueChanged<
T?> ? -
Called after local state is updated.
getter/setter pairinherited
- analytics → Analytics
-
Provides the configured
Analytics
functionality through theLoglytics
mixin per type ofD
.latefinalinherited - api → API
-
The Firestore API instance used for remote operations.
finalinherited
-
beforeLocalNotifyUpdate
↔ ValueChanged<
T?> ? -
Called before local state is updated.
getter/setter pairinherited
- cachedUserId ↔ String?
-
The ID of the currently authenticated user.
getter/setter pairinherited
-
defaultValueLocator
↔ TurboLocatorDef<
T> ? -
Function to provide default document value.
getter/setter pairinherited
-
doc
→ ValueListenable<
T?> -
Value listenable for the document state.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String?
-
Whether a document exists in local state.
The document ID.
no setterinherited
-
initialValueLocator
↔ TurboLocatorDef<
T> ? -
Function to provide initial document value.
getter/setter pairinherited
- isReady → Future
-
Future that completes when the service is ready.
no setterinherited
- listenable → Listenable
-
Listenable for the document state.
no setterinherited
- location → String
-
Used to define the location of Loglytics logging and implementation.
no setterinherited
- log → Log
-
Used to provide all logging capabilities.
latefinalinherited
-
onAuth
↔ FutureOr<
void> Function(User user)? -
Called when a user is authenticated.
getter/setter pairinherited
-
onData
→ Future<
void> Function(T? value, User? user) -
Handles incoming data updates from Firestore with pre and post-sync notifications.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
stream
→ FutureOr<
Stream< Function(User user)T?> > -
Returns a stream of data for the authenticated user.
no setterinherited
Methods
-
afterSyncNotifyUpdate(
T? doc) → Future< void> - Called after the local state has been updated with new data.
-
analyticsAs<
A extends Analytics> () → A -
Provides the configured
Analytics
functionality through theLoglytics
mixin per type ofA
.inherited -
beforeSyncNotifyUpdate(
T? doc) → Future< void> - Called before the local state is updated with new data.
-
createDoc(
{Transaction? transaction, required CreateDocDef< T> doc, bool doNotifyListeners = true}) → Future<TurboResponse< T> > -
Creates a new document both locally and in Firestore.
inherited
-
createLocalDoc(
{required CreateDocDef< T> doc, bool doNotifyListeners = true}) → T -
Creates a new document in local state.
inherited
-
deleteDoc(
{required String id, bool doNotifyListeners = true, Transaction? transaction}) → Future< TurboResponse> -
Deletes a document both locally and from Firestore.
inherited
-
deleteLocalDoc(
{required String id, bool doNotifyListeners = true}) → void -
Deletes a document from local state.
inherited
-
dispose(
) → Future< void> -
Disposes of the document service and releases resources.
inherited
-
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.
inherited
-
onError(
TurboFirestoreException error) → void -
Called when a stream error occurs.
inherited
-
rebuild(
) → void -
Forces a rebuild of the local state.
inherited
-
resetAndTryInitialiseStream(
) → Future< void> -
Resets and reinitialized the stream.
inherited
-
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.
inherited
-
turboVars<
V extends TurboAuthVars> ({String? id}) → V -
Returns a new instance of
V
with basic variables filled in.inherited -
updateDoc(
{Transaction? transaction, required String id, required UpdateDocDef< T> doc, TurboWriteable remoteUpdateRequestBuilder(T doc)?, bool doNotifyListeners = true}) → Future<TurboResponse< T> > -
Updates a document both locally and in Firestore.
inherited
-
updateLocalDoc(
{required String id, required UpdateDocDef< T> doc, bool doNotifyListeners = true}) → T -
Updates an existing document in local state.
inherited
-
upsertDoc(
{Transaction? transaction, required String id, required UpsertDocDef< T> doc, TurboWriteable remoteUpdateRequestBuilder(T doc)?, bool doNotifyListeners = true}) → Future<TurboResponse< T> > -
Upserts (updates or inserts) a document both locally and in Firestore.
inherited
-
upsertLocalDoc(
{required String id, required UpsertDocDef< T> doc, bool doNotifyListeners = true}) → T -
Upserts (updates or inserts) a document in local state.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited