Charlie Christensen
12/05/2020, 5:38 PMDataStore
if I want to access a value synchronously the documentation says to use runBlocking
like so runBlocking { dataStore.data.first() }
Would I be able to instead use something like
withContext(<http://Dispatchers.IO|Dispatchers.IO>) { dataStore.data.first() }
What is the difference between those two approaches?Adam Powell
12/05/2020, 5:42 PMrunBlocking
blocks the calling thread until the result is available. withContext
suspends until the result is available.Adam Powell
12/05/2020, 5:42 PMCharlie Christensen
12/05/2020, 5:44 PMrunBlocking
was a suspend function. Thanks so much!