Skip to content

State Flow and Shared Flow

Devrath edited this page Jan 21, 2024 · 5 revisions

Important points

  • Flows are mostly cold but state-flow and shared-flow are exceptions here
  • The St.Flow and Sh.Flow exist independently of collectors. This means that these flows remain active even if there are no collectors.
  • State Flow is a special case of shared flow.

Shared Flow

  • This is a flow that acts independently of collectors - Meaning the share flow is active regardless of whether there are any collectors or not.
  • Shared flow emits a current state and new state to the subscribers.
  • Shared-flow never completes and remains active. Even though all the subscribers go away, The Shared Flow remains active.

State Flow

  • State Flow is a version of Shared Flow
Clone this wiki locally