Ahmed
04/08/2022, 3:16 PMrunblock {
val result = methodCall(). // this method is suspended
repository.persistResultToDB(result)
}
so, the methodCall()
do we need to await for its completion, to be able to use the returned result
to persist them to the db ?henrikhorbovyi
04/08/2022, 3:25 PMpersistResultToDB()
method is also suspend so it will naturally waits for the result value. Because they are in the same coroutine scopeJoffrey
04/08/2022, 3:38 PMpersistResultToDB
is, you don't need to await a suspend function when you call it, it returns the value directly and you can use itAhmed
04/08/2022, 4:04 PMpersistResultToDB
is not suspended !Joffrey
04/08/2022, 4:06 PMmethodCall()
directly and using the return value is correctAhmed
04/08/2022, 4:06 PM