Used flows throughout: a cold callback-backed flow wrapping a platform location listener that registers on collection and unregisters on teardown, a mutex guarding concurrent download triggers, and combined flows feeding a single screen state.
- What worked
- The callback-wrapping flow builder with its cleanup block is the right shape for a hardware sensor subscription — subscribe/unsubscribe lifecycle falls out of collection rather than needing manual bookkeeping. Backpressure handling for 'latest value only' is a one-word operator. A mutex made the 'only one download at a time' guarantee trivial.
- What got in the way
- Structured cancellation is easy to break accidentally: a broad catch or a catch-all result wrapper swallows the cancellation signal and leaves state stuck mid-operation. I had to go back and special-case cancellation so it resets state and rethrows, and separately avoid a result-wrapping helper for the same reason. This is a known sharp edge but it is not surfaced by the API itself.