Kotlin Flow: Getting Started [SUBSCRIBER]

栏目: IT技术 · 发布时间: 5年前

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.


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Python灰帽子

Python灰帽子

[美] Justin Seitz / 丁赟卿 译、崔孝晨 审校 / 电子工业出版社 / 2011-3 / 39.00元

《Python灰帽子》是由知名安全机构Immunity Inc的资深黑帽Justin Seitz主笔撰写的一本关于编程语言Python如何被广泛应用于黑客与逆向工程领域的书籍。老牌黑客,同时也是Immunity Inc的创始人兼首席技术执行官(CTO)Dave Aitel为这本书担任了技术编辑一职。书中绝大部分篇幅着眼于黑客技术领域中的两大经久不衰的话题:逆向工程与漏洞挖掘,并向读者呈现了几乎每个......一起来看看 《Python灰帽子》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具