Kotlin 協同程式和資料流的其他資源
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
請使用這些額外的資源,進一步瞭解 Kotlin 協同程式和資料流。這些資源已按主題分組。
基本概念
取消
例外狀況
範圍
資料流
測試
程式庫、Jetpack 與協同程式
檢視層中的協同常式
深入解析
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],null,["# Additional resources for Kotlin coroutines and flow\n\nUse these additional resources to learn even more about Kotlin coroutines\nand flow. These resources are grouped by topic.\n\nBasics\n------\n\n- [First things first](https://medium.com/androiddevelopers/coroutines-first-things-first-e6187bf3bb21): This article teaches basic coroutine concepts, including `CoroutineScope`, `Job`, and `CoroutineContext`.\n- [The ABC of coroutines](https://youtu.be/bM7PVVL_5GM): Learn about the most common classes and functions used when working with coroutines.\n- [Coroutines in Android (series - 1st article linked)](https://medium.com/androiddevelopers/coroutines-on-android-part-i-getting-the-background-3e0e54d20bb): This post is the first in a series that teaches you about Kotlin coroutines.\n- [Understand Kotlin Coroutines on Android](https://www.youtube.com/watch?v=BOHK_w09pVA): This Google I/O 2019 talk gives an overview of using Kotlin coroutines on Android.\n- [Coroutines codelab](/codelabs/kotlin-coroutines): This codelab shows you how to use Kotlin coroutines to manage background threads and simplify your async code.\n- [Coroutines: how to manage async tasks in Kotlin](https://youtu.be/6manrgTPzyA): Learn about the state of coroutines in Android as of 2020.\n\nCancellation\n------------\n\n- [Cancellation in coroutines](https://medium.com/androiddevelopers/cancellation-in-coroutines-aa6b90163629): This article talks about about the ins and outs of coroutine cancellation.\n- [Coroutines: Gotta catch 'em all](https://www.youtube.com/watch?v=w0kfnydnFWI): Learn best practices for handling cancellation and exceptions in Kotlin coroutines.\n\nExceptions\n----------\n\n- [Exceptions in coroutines](https://medium.com/androiddevelopers/exceptions-in-coroutines-ce8da1ec060c): Learn how exceptions are propagated in coroutines and how to handle them.\n- [Coroutines: Gotta catch 'em all](https://www.youtube.com/watch?v=w0kfnydnFWI): Learn best practices for handling cancellation and exceptions in Kotlin coroutines.\n\nScopes\n------\n\n- [Easy coroutines in Android: viewModelScope](https://medium.com/androiddevelopers/easy-coroutines-in-android-viewmodelscope-25bffb605471): This article describes `viewModelScope`, an extension property that adds coroutines support to the `ViewModel` class.\n- [Patterns for work that shouldn't be cancelled](https://medium.com/androiddevelopers/coroutines-patterns-for-work-that-shouldnt-be-cancelled-e26c40f142ad): This article describes how to trigger coroutines that shouldn't be cancelled using an `applicationScope` or `externalScope`.\n\nFlow\n----\n\n- [Going with the Flow](https://youtu.be/emk9_tVVLcc): Learn about the flow API and its benefits.\n- [Advanced Coroutines with Kotlin Flow and LiveData](/codelabs/advanced-kotlin-coroutines): Learn how to use Kotlin coroutines with `LiveData` and flow in an Android app.\n- [Lessons learnt using Coroutines Flow in the Android Dev Summit 2019 app](https://medium.com/androiddevelopers/lessons-learnt-using-coroutines-flow-4a6b285c0d06): This article highlights best practices and other lessons learned when adding flow support to the Android Dev Summit 2019 app.\n- [Things to know about Flow's shareIn and stateIn operators](https://medium.com/androiddevelopers/things-to-know-about-flows-sharein-and-statein-operators-20e6ccb2bc74): This article talks about how the `stateIn` and `shareIn` operators can be used to improve performance, or even as a caching mechanism.\n- [Migrating from LiveData to Kotlin Flow](https://medium.com/androiddevelopers/migrating-from-livedata-to-kotlins-flow-379292f419fb): This article talks about what's the equivalent Flow code for some of the most common LiveData patterns you can have in your app. This helps if you're interested in migrating from LiveData to Flow.\n\nTesting\n-------\n\n- [Testing coroutines on Android](https://youtu.be/KMb0Fs8rCRs): Learn about the best practices to test your coroutines.\n- [Testing codelab - Coroutines section](https://developer.android.com/codelabs/advanced-android-kotlin-training-testing-survey#3): Learn about testing ViewModels that use coroutines by replacing `Dispatchers.Main` with a `TestCoroutineDispatcher`.\n- [Testing two consecutive LiveData emissions in Coroutines](https://medium.com/androiddevelopers/testing-two-consecutive-livedata-emissions-in-coroutines-5680b693cbf8): Learn how to use `TestCoroutineDispatcher` to pause and resume the execution of coroutines.\n\nLibraries, Jetpack, and Coroutines\n----------------------------------\n\n- [LiveData with Coroutines and Flow](https://www.youtube.com/watch?v=B8ppnjGPAGE): This talk from the 2019 Android Dev Summit covers how to use the `liveData` coroutine builder along with testing patterns and antipatterns to make clean, efficient, and solid reactive UIs.\n- [Building a Kotlin extensions library](/codelabs/building-kotlin-extensions-library): Learn how to build a Kotlin extensions library that adds coroutines and flow support to existing classes.\n- [Simplifying APIs with coroutines and Flow](https://medium.com/androiddevelopers/simplifying-apis-with-coroutines-and-flow-a6fb65338765): Learn how to simplify your libraries with coroutine adapters, create your own, and see how they work under the hood.\n\nCoroutines in the view layer\n----------------------------\n\n- [Suspending over Views](https://medium.com/androiddevelopers/suspending-over-views-19de9ebd7020): This post talks about how coroutines can make UI programming easier.\n\nUnder the hood\n--------------\n\n- [Suspend functions - Kotlin Vocabulary](https://youtu.be/IQf-vtIC-Uc): Learn why coroutines are important and how they work under the hood.\n- [The suspend modifier under the hood](https://medium.com/androiddevelopers/the-suspend-modifier-under-the-hood-b7ce46af624f): Learn how the compiler transforms your code to suspend and resume the execution of your coroutines."]]