https://kotlinlang.org logo
#coroutines
Title
# coroutines
a

Alexjok

01/28/2019, 7:56 AM
Hello! How can I declare a function
Copy code
override suspend fun save(something: Something) = withContext(Dispatchers.Default) {
   doWork()
}
in the interface?
g

gildor

01/28/2019, 7:58 AM
Copy code
interface Savable {
   suspend fun save(something: Something)
}
a

Alexjok

01/28/2019, 8:08 AM
brrr, sorry for the stupid question... Intellij underlined in red because the
save
method in
jpa model
returns the saved object. I need a cup of coffee 🙂
g

gildor

01/28/2019, 8:10 AM
ah, yeah, you have to specify also return type if doWork() has it
8 Views