Kotlin Flow Operators - Terminal + Map, Filter Buffer Operators | CheezyCode - Hindi
ฝัง
- เผยแพร่เมื่อ 5 ก.พ. 2025
- Kotlin Flow Tutorial - Learn how to use map, filter, and buffer operators in Kotlin Flow. Learn what terminal operators are, and how they are used to start the flow. Terminal operators are marked with suspend modifier whereas other operators like map and filter are simple functions that return a new Flow object that needs to be collected i.e. they maintain the cold flow property. Terminal operators like collect, first, firstOrNull are explained with an example.
Map, Filter, and Buffer Operators in Kotlin flow are explained with a simple example. Learn by creating a simple example in Hindi.
Topics covered -
1. What are terminal operators?
2. First, Collect, FirstOrNull Operator in Flow
3. Map, Filter, Buffer Operator in Flow
4. Complete Example of Operators in Kotlin Flow.
Kotlin Flows Playlist -
• Kotlin Flows Tutorials
Jetpack Paging Tutorial -
• Android Paging 3 | Jet...
Complete Dependency Injection Playlist Link -
• Dagger 2 - Dependency ...
Complete Android Architecture Components Playlist -
• Android Architecture C...
Beginner series in Android Playlist (Hindi) -
• Android Tutorials Step...
Kotlin Beginners Tutorial Series -
• Kotlin Beginner Tutori...
For more info - visit the below link
www.cheezycode.com
We are social. Follow us at -
Facebook - / cheezycode
Twitter - / cheezycode
Instagram - / cheezycode
Bro you are doing an amazing job, this channel is a goldmine for learning android development in kotlin
Thank you 🤘
Just now completed the third part and till now everything is crystal clear. No doubt Cheezy Code is going to achieve newer heights in the coming days. I hope to see more awesome content coming up in this channel. May God bless you :)
You are too good bro thanks for your support
Maja aa Gaya! Very much informative. 😃
🤘
Very good explanation
thank you so much i learned so much from this playlist
love amul cheese & cheezy code 🥰🥰
Superb💯💯💯
Thanks 🤗
Does it offer any advantange to get the API response in a flow(over Livedata/ suspend function) when Api is a one off call?
Brilliant
Thank you 😀🙏🏻
You’re welcome 😊
Is producer and consumer working under the same coroutine scope in this example?. Suppose a consumer perform long running task while collecting data under the same coroutine scope then the producer will stop emitting data until the long running task is completed because the coroutine scope of the producer and consumer is same. Is this true?.
both are different coroutine..
if a consumer makes a network call while collecting data from producer then the producer will not emit data as we know flow is cold. Flow is cold means when a consumer side make a delay then producer side is also suspended. It means both work under the same coroutine scope.
Nice
Best
Hi, I have a doubt. For eg: fun getUsers(): Flow(Using Flow) and suspend fun getUsers(): List (Normal Coroutine). Here both the function will fetch the list of data from the API. What are the benefits of converting API data or List into FLOW? Also, my app does not retrieve streams of data like stock market or video streaming app.
fun getUsers(): Flow - this will return every time List to you. After few seconds or any time interval - it will return you a list.
fun getUsers(): List - This is just one time. You call this function, gives you result and then it's done. It won't keep listening it for you.
Flow ka use waha hoga - jahan pe you are expecting continuous supply of data like stock data, gps data...you call the method once and it keeps on giving you data after certain interval of time....Hope this helps.
@@CheezyCode Thank you for replying. So if the app doesn't want to receive a continuous stream of data. So will it be beneficial to use FLOW API in the project?
yes - livedata ko repository level pe use nahi karna - observable stream banane ke liye Flow ka use kar rahe hai...
amazing
Thank you! Cheers!
Kotlin Multi-platform ka playlist kab start kar rahe ho
Have a doubt, Why didn't it went into recurssion since in onCompletion we are calling emit(6) and onCompletion is called on once everything is completed.
But then again in onCompletion we are calling emit(6) then this shoudl keep on going right?
Am i missing something here? If so can someone correct me on this.
Jahapana tussi great ho !!!
🤘
Personal Note : onStart, onEach, onCompletion, terminal, first, toList non terminal, map, filter, buffer, asFlows
🙏🙏
❤
🧡
Last rapp is the best. Ye language sikh lo...
🤘
: Skipped 230 frames! The application may be doing too much work on its main thread.
sir aisi errors ko kaise handle kare as{ i m fetching and saving data in form of images and text to firebase }
you are doing network calls on main thread. Don't do that. try to do the network and saving data call on with coroutines.
amazing
Thanks!