I am playing with the new backing field feature introduced in Kotlin 2.0, however I am encountering some problem when using it on data type that is not a superclass/subclass of one and another.
private val _youTubeVideosState = Channel<YouTubeVideosState>()
val youTubeVideosState = _youTubeVideosState.receiveAsFlow()
How to convert this with using backing field? I tried the below but wasn’t able to access the send()
method of Channel.
val youTubeVideosState: Flow<YouTubeVideosState>
field = Channel<YouTubeVideosState>().receiveAsFlow()
If I tried the below it is complaining about the type not being superclass of subclass.
val youTubeVideosState: Flow
field = Channel()