Update CoroutineScope docs to recommend explicit scope
See original GitHub issueCoroutineScope
documentation currently recommends the following code pattern:
class MyActivity : AppCompatActivity(), CoroutineScope by MainScope() {
...
}
It’s time to update it to explict scope style, which seems to be winning in its clarity and popularity:
class MyActivity : AppCompatActivity() {
private val scope = MainScope()
...
}
Issue Analytics
- State:
- Created 4 years ago
- Reactions:17
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Use Kotlin coroutines with lifecycle-aware components
A LifecycleScope is defined for each Lifecycle object. Any coroutine launched in this scope is canceled when the Lifecycle is destroyed. You can ......
Read more >Coroutine Context and Scope - Roman Elizarov - Medium
By convention, a context in CoroutineScope contains a Job that is going to become a parent of new coroutine (with the exception of...
Read more >Coroutine context and dispatchers - Kotlin
All coroutine builders like launch and async accept an optional CoroutineContext parameter that can be used to explicitly specify the dispatcher ...
Read more >Kotlin Coroutines 1.5: GlobalScope Marked as Delicate ...
A global CoroutineScope is not bound to any job. Global scope is used to launch top-level coroutines that operate during the whole application ......
Read more >How to return value from coroutine scope - Stack Overflow
If you need to run works in parallel then you can use coroutineScope or async coroutine builder functions. However, in your case you...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks @qwwdfsad , Just to confirm, do you mean like this?
As per this guideline, can you please help me with the following example if any changes need to be done?