lastRemoteTimestamp method

int lastRemoteTimestamp(
  1. String collectionName
)

Get the last remote timestamp for a collection.

This is the UTC millisecond timestamp of the most recent change received from the server for this collection. Used internally for historic sync to request only changes since this timestamp.

Returns 0 if no remote changes have been received yet.

Example:

final lastSync = realmSync.lastRemoteTimestamp('chat_messages');
print('Last synced at: ${DateTime.fromMillisecondsSinceEpoch(lastSync)}');

Implementation

int lastRemoteTimestamp(String collectionName) {
  return _lastRemoteTsByCollection[collectionName] ?? 0;
}