Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flow is not available in kotlinx-coroutines-android:1.5.0?

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()
}

enter image description here

like image 777
Rifat Avatar asked Sep 23 '21 05:09

Rifat


1 Answers

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.

like image 185
HamzehXX Avatar answered Sep 24 '22 06:09

HamzehXX