I’ve found myself using this pattern quite a lot, is there a better way (options is `Deferred<Map...
a
I’ve found myself using this pattern quite a lot, is there a better way (options is
Deferred<Map<String, String>
?
Copy code
options.asPromise().then { // get a value from the options map }.asDeferred()
p
I suppose you can't
await()
, because you're not in coroutine, right?
a
correct. This pattern usually happens when I had something like
val setting = options['settingName']
in my code I don’t often need to add additional coroutines as the functions are usually suspend functions (lots of this code is in db service classes) and i can call
await()
from there