Deep dive into Kotlin Flow

Androidアプリ開発では状態に応じた reactive UI が必須と言えます。堅牢なアプリのためにSubscription 型のデータストリームとその操作を採用することが多く、Kotlin Coroutine を使う場合は Flow と Flow operators を利用することになります。 Kotlin Coroutine の導入では、まるで同期的な処理文かのように非同期処理を書けることがよく取り上げられます。しかし、Flow が関わってくるとそう単純な話ではありません。特に複数の Flow が関わる場合に複雑性は上がり、Flow の呼び出し部分だけの理解では不足すると言えるでしょう。その Flow の実体クラスや upstream、また operators が巻き込んだ外部依存のすべてを包含した環境を考慮すべきです。 本セッションでは既存の Flow operators の解説、custom Flow operators の実装・テスト手法及びそのポイントを話します。コードの解説やサンプルコードを通して、Flow の基礎を学ぶ機会を提供したいと思います。 In the recent Android development, the concept of Reactive UI is mandatory. Many developers have adopted subscription-based data streaming for robust softwares, and they have been using Flow from Kotlin Coroutine. As for asynchronous programming in Kotlin Coroutine, the benefit of synchronous-like coding style is often highlighted. However, Flow doesn't always allow such simplification. In particular, orchestrated multiple Flows would be complicated. I would argue that simply understanding the subscription code of a Flow is not enough to write bug-less code. In many cases, you need to know the actual Flow class, the design of the upstream, the external dependencies involved by operator chaining and/or the entire of the running environment. In this session, I will talk about the design/behavior of the existing Flow operators, how to implement/test new custom Flow operators, and what point should be tested. You could grasp the basics of Flow from my session. Keywords: Channel, select clause, intermediate operators, terminal operators, cashapp/turbine

  • Jumpei Matsuda Drivemode, Inc.


概要

  • 日時 2025.09.12 / 15:20 ~ 16:00 (40min)
  • 場所 Koala
  • 言語 英語

対象者

もうこれ以上、upstreamFlow.makeComplicated().collect { giveUp() } という気持ちになりたくない方 Those who want to stop feeling like *upstreamFlow.makeComplicated().collect { giveUp() }*.

Android is a trademark of Google LLC. The Android robot is reproduced or modified from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License. Android、Google Play、Google Play ロゴは、Google Inc. の商標です。
これまでのDroidKaigi

© 2014- DroidKaigi Committee