svenjacobs
08/28/2019, 7:30 AMChannel with Flow in my Android application. But now I'm stuck in a conceptual thinking problem: Right now I use Channel to handle UI events on Android views, for instance clicks inside a RecyclerView.Adapter. I create an instance of Channel in the view (or presenter, it doesn't matter) and pass it to the RecyclerView.Adapter. Then inside the adapter I could just pass click events to the channel. But with Flow, the flow needs to be created at the place where the data is emitted. However I don't want to have x flows in my Adapter for every view the adapter manages. Is Flow even suited for UI events or are UI events classically hot streams? Am I just trying to apply Flow where Channel is the right choice after all?bdawg.io
08/28/2019, 7:36 AMsvenjacobs
08/28/2019, 7:37 AMdarkmoon_uk
08/28/2019, 7:37 AMFlow isn't necessarily a replacement for Channel - Channel is appropriate for 'hot' events like live interactions with your UI.darkmoon_uk
08/28/2019, 7:39 AMBehaviourSubject - subscription to which offers an immediate 'last known' value (cold), followed by subsequent updates (hot).darkmoon_uk
08/28/2019, 7:39 AMConflatedBroadcastChanneldarkmoon_uk
08/28/2019, 7:39 AMdarkmoon_uk
08/28/2019, 7:39 AMsvenjacobs
08/28/2019, 7:40 AMConflatedBroadcastChannel 🙂 So basically channels are the right choice for hot UI eventsdarkmoon_uk
08/28/2019, 7:40 AMsvenjacobs
08/28/2019, 7:40 AMChannel with Flow for my API requestsdarkmoon_uk
08/28/2019, 7:41 AMasFlow to gain the Flow-API benefits for any BroadcastChannel.darkmoon_uk
08/28/2019, 7:42 AMyshrsmz
08/28/2019, 8:17 AMyshrsmz
08/28/2019, 8:18 AMelizarov
08/28/2019, 8:57 AMdarkmoon_uk
08/28/2019, 9:19 AMStateFlow is most incisive, because:
- Data Flow implies data in an untyped, raw form, which this is (usually) not.
- Value Flow somewhat clashes by name with Kotlins val, implying unchanging, or constant, which this is not.
- State Flow - as you said yourself, succinctly point to the fact there is an ever-present state of this thing, which can be accessed... but which flows, changes.Dominaezzz
08/28/2019, 1:28 PMcallbackFlow.Dominaezzz
08/28/2019, 1:29 PM