When I am trying to change the Dao to the new Flow
Api, I am getting the compilation error stating that
Not sure how to convert a Cursor to this method's return type
public abstract kotlinx.coroutines.flow.Flow<java.util.List<com.ezek.ezign.model.ECampaign>> readCampaigns();
刀是
@Dao
interface CampaignDao {
@Query("SELECT * FROM campaign ORDER BY timeStamp ASC")
fun readCampaigns(): Flow<List<ECampaign>>
@Query("SELECT * FROM campaign WHERE id = :campaignId")
fun readCampaign(campaignId: Int): Flow<ECampaign>
}
依赖关系是
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2'
implementation "android.arch.persistence.room:runtime:$rootProject.ext.room_version"
kapt "android.arch.persistence.room:compiler:$rootProject.ext.room_version"
//room_version = "2.1.0"
I have tried with Both List
and ArrayList
, but No luck.
Thanks in advance.