Kulwinder Singh
11/04/2018, 9:47 AMinit and getLastState are suspend function ?louiscad
11/04/2018, 9:52 AMasync and await.Kulwinder Singh
11/04/2018, 9:55 AMKulwinder Singh
11/04/2018, 9:59 AMKulwinder Singh
11/04/2018, 10:00 AMasync { musicProvider.init() }.await()
val lastState = async { musicProvider.getLastState() }.await()louiscad
11/04/2018, 10:10 AMlouiscad
11/04/2018, 10:12 AMval lastStateAsync = async { musicProvider.getLastState() }
musicProvider.init()
val lastState = lastStateAsync.await()Daniel Tam
11/04/2018, 10:50 AMlistOf(
async { ... },
async { ... }
).awaitAll()Daniel Tam
11/04/2018, 10:51 AMgetLastState, and since async calls now work intuitively with their parent scope if they throwbdawg.io
11/04/2018, 11:04 PMinit? (By result I mean was there an exception). If not, just launch that and then use getLastState directly uiScope.launch {
launch { runCatching { musicProvider.init() } }
val lastState = musicProvider.getLastState()
...
}