progressAsFlow

abstract fun progressAsFlow(direction: Direction, progressMode: ProgressMode): Flow<Progress>

Create a Flow of Progress-events that track either downloads or uploads done by the SyncSession.

This is only an indicator of transferring of data and an Progress-event with Progress.isTransferComplete being true does not guarantee that the data is already visible in the realm. To wait for data being integrated and visible use downloadAllServerChanges/uploadAllLocalChanges.

If the flow is created with ProgressMode.CURRENT_CHANGES the Progress will only ever increase and will complete once Progress.isTransferComplete = true.

If the flow is created with ProgressMode.INDEFINITELY the Progress can both increase and decrease since more changes might be added while the flow is still active. This means that it is possible for one Progress instance to report isTransferComplete = true and subsequent instances to report isTransferComplete = false.

The flow will be completed if the realm is closed.

The flow has an internal buffer of Channel.BUFFERED but if the consumer fails to consume the elements in a timely manner the flow will be completed with an IllegalStateException.

Throws

if invoked on a realm with Flexible Sync enabled.