Flow vs SharedFlow

what is Flow?

Flow is an interface , its just emit value it doesn't store any value on screen rotation it will be started from first. we use flow if you want to emit any api response to view or any multiple emit need to be done.

Example of Flow

And collecting that response inside view using corroutine scope

what is SharedFlow?

SharedFlow is also a flow it doesnt keep a value with it so only in below example we are not passing any value to it for the variaable _onJoinEvent.They will send event if they are no collectors for them.Mostly sharedflow are used to send one time event it will send the same value if already sent by it not like stateflow.It doesnt emit the last value on screen rotation but in stateflow it will be updated with last value.

And inside view we can call

We use flow when we want to emit multiple things and for one time event its good to use sharedflow.

Knowledge is everything.Check out my app at https://play.google.com/store/apps/details?id=com.vibe.britevibe

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to Convert an iOS App into an Android App?

Hello Triangle, Meet Swift! (And Wide Color)

Automated Feature Flagging Integration for iOS — JustTweak V6

MyCommunity.Today App is HERE!

UI Testing iOS application with EarlGrey

Escalated Testing Pyramid

How to increase Accessibility of the Application?

Rx(UITextField)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Pandiyan Mani

Pandiyan Mani

Knowledge is everything.Check out my app at https://play.google.com/store/apps/details?id=com.vibe.britevibe

More from Medium

The Story of FPS Meter

Bloody (Android) Handlers

How to catch exceptions from Kotlin Flow?

Requesting Multiple Permissions in Jetpack Compose…