본문 바로가기

flow3

(Coroutine) 7. Flow Basics 1. Data Stream 코루틴에서 Flow는 하나의 단일 값만 반환할 수 있는 suspend function과는 달리 여러 값을 순차적으로 내보낼 수 있는 즉, 데이터 스트림을 구현하기 위한 라이브러리이다. 예를 들어, 데이터베이스의 업데이트 내용들을 Flow를 통해 라이브하게 얻을 수 있다. 여기서 설명하는 데이터 스트림은 크게 3가지 항목으로 구성된다. Producer (생산자) Producer는 데이터 스트림에 추가되는 데이터를 생산하는 역할을 한다. Flow를 이용해 비동기적으로 데이터를 생성할 수 있다. Intermediary (중개자) 데이터 스트림을 통해 내보내는 각각의 값이나 스트림 자체를 수정하는 역할을 한다. Optional하기 때문에 반드시 필요한 것은 아니다. Consumer (.. 2022. 11. 2.
(번역) A safer way to collect flows from Android UIs 이 게시물은 Android Developers Medium에 작성되어있는 A safer way to collect flows from Android UIs를 번역 및 의역하여 정리한 게시물입니다. 잘못된 정보는 댓글로 첨언해주시면 감사하겠습니다. A safer way to collect flows from Android UIs Learn how the repeatOnLifecycle API protects you from wasting resources and why it’s a good default for flow collection in the UI layer. medium.com 안드로이드 UI에서 안전하게 flow 수집하기 안드로이드 앱에서, Kotlin flows는 일반적으로 UI Layer에.. 2022. 8. 31.
(번역) Migrating from LiveData to Kotlin's Flow 이 게시물은 Android Developers Medium에 작성되어있는 Migrating from LiveData to Kotlin's Flow를 번역 및 의역하여 정리한 게시물입니다. 잘못된 정보는 댓글로 첨언해주시면 감사하겠습니다. Migrating from LiveData to Kotlin’s Flow In this post you’ll learn how to expose Flows to a view, how to collect them, and how to fine-tune it to fit specific needs. medium.com LiveData에서 Kotlin Flow로 이전 LiveData는 2017년에 우리에게 필요한 것이었습니다. (Google I/O `17에서의 AAC 공개) .. 2022. 8. 31.