Toji
Toji

Reputation: 13

Too many arguments for public abstract fun in kotlin

While making a to-do list for Android in Kotlin, I was trying to pass the "id" in the brackets but got an error. Also, the tutorial I learned it from was working fine and I am facing this issue. How to solve this problem?

Problem

I was to expect it to work fine. All other files are correct only this one has a problem. And for that reason, my app's not running.

My implementation of getATodoById inside TodoDAO -

TodoDAO

Upvotes: 1

Views: 543

Answers (1)

Egor
Egor

Reputation: 40218

Check out Pass simple parameters to a query. You should pass id as an argument to both the method and the query:

@Query("SELECT * FROM `todo-table` WHERE id = :id")
abstract fun getATodoById(id: Int): Flow<Todo>

Upvotes: 2

Related Questions