综合开发

Kotlin Flow: Getting Started [SUBSCRIBER]

微信扫一扫,分享到朋友圈

Kotlin Flow: Getting Started [SUBSCRIBER]

Kotlin Flow Primer

Learn about where Kotlin Flow fits in the landscape of asynchronous programming on Android, and define cold, asynchronous streams.

See how to create an asynchronous flow and compare to synchronous alternatives, and learn about collecting a flow.

Learn about the use of various flow builders, including the flowOf function and asFlow that converts collections like lists to flows.

See how Kotlin Flow adheres to the notion of structured concurrency, and implement a simple use case of flow cancellation via a timeout.

Learn how to manipulate flows with the common map, filter, and reduce operators and also learn about the Flow transform operator and terminal operators.

Unlike Rx streams, completion events are not inherent in flows. See how to add actions that run when a flow completes, both imperatively and declaratively.

Working with Flows

Coroutine context determines the configuration in which a flow runs; see how to change the coroutine context using flowOn.

Flows are intended to be used for long running operations; see how to use buffering to handle flow processing and flow emission taking different times.

Learn about the operators that are available in the Kotlin Flow API to combine flows, and also see how to use the onEach and flatMap operators.

Exceptions may occur when flow elements are being emitted or collected; see how to handle exceptions in both cases.

Kotlin Flow on Android

Switch from simple flows in IntelliJ IDEA to working with flows in an Android app, and get an introduction to the Android sample project.

See how to create a flow running from the app local database through the app repository and ViewModel and into the user interface.

Learn about how channels can be used to inject elements into flows, and apply your knowledge of flow operators in the Android app.

Apply what you learned about combining operators to combine a flow from the database with a flow of data retrieved over the network.

美图公司:2019年营收9.779亿元 高级订阅收入同比增长518.1%

上一篇

Java程序员应该知道的20个有用的lib开源库

下一篇

你也可能喜欢

评论已经被关闭。

插入图片

热门栏目

Kotlin Flow: Getting Started [SUBSCRIBER]

长按储存图像,分享给朋友