Reputation: 1888
kotlinx.coroutines.flow.Flow
is not available with implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0'
, but is available with implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.0'
.
Is it depricated? What is alternative?
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import kotlinx.coroutines.flow.Flow
@Dao
interface WordDao {
@Query("SELECT * FROM word_table ORDER BY word ASC")
fun getAlphabetizedWords(): Flow<List<Word>>
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insert(word: Word)
@Query("DELETE FROM word_table")
suspend fun deleteAll()
}
Upvotes: 8
Views: 2212
Reputation: 187
Kotlin Flow is not deprecated. Use the latest version of kotlinx-coroutine-android
(1.5.2): org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2
It works for me.
Upvotes: 11