Code: Select all
@Dao
interface CartDao {
@Query("DELETE FROM cart_table")
fun clearCart() // This line causes the error
}
What I've Tried:
Changing the return type to Int, like this:
kotlin
Copy
Edit
fun clearCart(): Int
Adding suspend to make it a coroutine function:
kotlin
Copy
Edit
@Query("DELETE FROM cart_table")
suspend fun clearCart(): Int
Clean and rebuild the project
What is the correct return type for a DELETE query in Room?
Is there a recommended way to declare a method that deletes all rows in a Room table?
Tech Stack:
Kotlin
Room version: 2.5.2
Hilt
Android Studio Giraffe
Gradle + KAPT
Thanks in advance!