toString method
A string representation of this object.
Some classes have a default textual representation,
often paired with a static parse
function (like int.parse).
These classes will provide the textual representation as
their string representation.
Other classes have no meaningful textual representation
that a program will care about.
Such classes will typically override toString
to provide
useful information when inspecting the object,
mainly for debugging or logging.
Implementation
@override
String toString() {
switch (type) {
case SyncEventType.update:
return 'CacheSyncEvent: Updated key "$key"';
case SyncEventType.delete:
return 'CacheSyncEvent: Deleted key "$key"';
case SyncEventType.batchUpdate:
return 'CacheSyncEvent: Batch updated ${keys?.length} keys';
case SyncEventType.batchDelete:
return 'CacheSyncEvent: Batch deleted ${keys?.length} keys';
case SyncEventType.clear:
return 'CacheSyncEvent: Cleared cache';
case SyncEventType.syncStarted:
return 'CacheSyncEvent: Sync started';
case SyncEventType.syncCompleted:
return 'CacheSyncEvent: Sync completed';
case SyncEventType.error:
return 'CacheSyncEvent: Error - $error';
}
}