CloudSyncService class
Service for syncing logs to a cloud backend.
Extends BaseSyncService from voo_core to reuse common batching,
retry, and HTTP logic. Adds logging-specific features:
- Priority queue for error/fatal logs
- Minimum level filtering
- Immediate flush for priority items
Constructors
- CloudSyncService({required CloudSyncConfig config, Client? client})
Properties
- config → BaseSyncConfig
-
Configuration for the sync service.
finalinherited
- consecutiveFailures → int
-
Number of consecutive sync failures.
no setterinherited
- endpoint → String
-
The endpoint URL for syncing items.
Subclasses must implement this to return the appropriate endpoint.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- onError ↔ void Function(String error, int retryCount)?
-
Callback for sync errors.
getter/setter pairinherited
- onStatusChanged ↔ void Function(SyncStatus)?
-
Legacy callback for sync status changes.
getter/setter pair
- pendingCount → int
-
Get the current queue size (includes priority queue).
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- serviceName → String
-
Name of this service (for debug logging).
finalinherited
- status → SyncStatus
-
Current sync status.
no setterinherited
- syncStatus → CloudSyncStatus
-
Get the current sync status.
Returns CloudSyncStatus for backwards compatibility.
no setter
Methods
-
dispose(
) → void - Dispose resources.
-
flush(
) → Future< bool> - Manually trigger a sync of all pending items.
-
formatPayload(
List< LogEntry> logs) → Map<String, dynamic> - Formats items into a JSON payload for the API. Subclasses must implement this to format their specific item types.
-
initialize(
) → void -
Initialize the sync service and start the batch timer.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
queueItem(
LogEntry item) → void -
Queue an item for syncing.
inherited
-
queueItems(
Iterable< LogEntry> items) → void -
Queue multiple items at once.
inherited
-
queueLog(
LogEntry log) → void - Queue a log entry for syncing. Maintains backwards compatibility with original API.
-
shouldFlushImmediately(
LogEntry log) → bool - Optional: Check if an item should trigger immediate flush. Return true for high-priority items (e.g., errors).
-
shouldQueueItem(
LogEntry log) → bool - Optional: Filter items before adding to the queue. Return true to include the item, false to skip it.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited