协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
kotlin-concurrency-and-flow【开发与工程】Use when writing or reviewing Kotlin coroutine scope ownership, raw Thread or Executor work, init launches, non-suspending launch APIs, runBlocking, cancellation, StateFlow, SharedFlow, Channel, stateIn, SharingStarted, state updates, or one-shot events.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Give asynchronous work an explicit owner and lifetime, then model durable state and transient events with primitives whose delivery and replay semantics match the product contract.
launch, callback, or deferred wrapper merely for convenience.Channel hands each event to one consumer; a configured
SharedFlow broadcasts to active consumers. If that consumer contract is
unknown, state both options and the decision needed before choosing one.
For a one-consumer navigation handoff that must survive a collector gap,
choose a buffered Channel exposed as receiveAsFlow(); do not preserve a
replay-zero SharedFlow after identifying event loss as the defect.| Signal | Read |
|---|---|
Stored CoroutineScope, raw Thread or Executor work, init { launch }, fire-and-forget API, runBlocking, broad catch, or cancellation boundary | Structured concurrency |
StateFlow, SharedFlow, Channel, stateIn, SharingStarted, .value, state updates, sentinel values, or one-shot events | Flow state and events |
| Compose collection or UI effect handling | Compose state and effects |