In this article, we will talk about Kotlin Coroutines, more specifically, about Flow. Probably the best way to understand it is by using a sample, we will explain how to use it with Firebase Realtime Database.
Before start is essential to make a small introduction: as you know Kotlin coroutines is the new Kotlin way to write asynchronous non-blocking code, you can implement it in various ways with different kinds of operators, the most common implementation is to invoke a suspend function and wait for a result, with Flow the game is different, because it allows us to create a data stream and to listen to it by using a FlowCollector. If you are comfortable with RxJava, Flow works like an Observable, and the FlowCollector as an Observer.
Report Story