SyncEvent class

Event emitted during sync operations.

Events provide visibility into the sync lifecycle and allow you to build features like sync status indicators, conflict notifications, and error handling.

Example:

// Listen to all sync events
SyncLayerCore.instance.syncEngine.events.listen((event) {
  print('Event: ${event.type}');
  print('Collection: ${event.collectionName}');
  print('Record: ${event.recordId}');
  print('Time: ${event.timestamp}');

  if (event.error != null) {
    print('Error: ${event.error}');
  }

  if (event.metadata != null) {
    print('Metadata: ${event.metadata}');
  }
});

Constructors

SyncEvent({required SyncEventType type, String? collectionName, String? recordId, Map<String, dynamic>? metadata, String? error})

Properties

collectionName String?
The collection name associated with this event, if applicable.
final
error String?
Error message if the event represents a failure.
final
hashCode int
The hash code for this object.
no setterinherited
metadata Map<String, dynamic>?
Additional metadata about the event.
final
recordId String?
The record ID associated with this event, if applicable.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
timestamp DateTime
When the event occurred.
final
type SyncEventType
The type of event that occurred.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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