https://github.com/jimmymcbride/flows
https://github.com/jimmymcbride/flows
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/jimmymcbride/flows
- Owner: JimmyMcBride
- Created: 2022-11-14T12:23:11.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-11-14T15:50:15.000Z (over 2 years ago)
- Last Synced: 2025-01-15T13:10:11.220Z (5 months ago)
- Language: Kotlin
- Size: 98.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Kotlin Flows
## Keywords And Definitions
- **Flow:** is a type that can emit multiple values sequentially, as opposed to suspend functions
that return only a single value. For example, you can use a flow to receive live updates from a
database.
- **Reactive Programing:** is a declarative programming paradigm concerned with continuous *streams
of data* and observing or reacting to change within the data stream.
- **Data Streams:** are comprised of three entities to create a sequential flow of data over time.
- A **producer** produces data that is added to the stream. Thanks to coroutines, flows can also
produce data asynchronously.
- **(Optional) Intermediaries** can modify each value emitted into the stream or the stream
itself.
- A **consumer** consumes the values from the stream.
- **Flow Builders:** are the tools you use to build your flows. Examples: flow, asFlow, flowOf, ect.
- **Flow Operators:** are used to transform flows. There are two types of flow operators:
***intermediate*** and ***terminal***.
- **Intermediate operators** are used for modifying the data flow between the producer and the
consumer in order to meet the requirements of the following layer. Examples: map, reduce,
fold, ect.
- **Terminal operators** are the operators that actually start the flow by connecting the flow
builder, operators with the collector. Example: fist, last, collect, collectLatest, ect.> When you apply a terminal operator, that flow is then created and starts emitting values.
> Intermediate operators just execute a chain of commands in a lazy fashion.