disableNetwork

abstract suspend fun disableNetwork()(source)

Turns the library's network access off, as an airplane-mode switch in an app or a test does: until enableNetwork, it sends nothing. Reads are answered from the cache as offline, reactive reads report RefreshState.Paused, writes that may queue are queued, a sync pass sends nothing, and a Storage download is answered from the file cache. A request that must reach the server (a ReadStrategy.NetworkOnly read, a MutationStrategy.OnlineOnly write, an rpc, a Storage call other than a download) throws NetworkDisabledException. A request already on the wire still answers, and so does a resumable upload created or paused while access was on: it sends its chunks until it ends.

SyncStatus.network is NetworkStatus.DISABLED as soon as this returns. The switch is not kept: a new client starts with network access on. Calling it again changes nothing.

Throws

when the client is closed.