Skip to content

Latest commit

 

History

History
10 lines (8 loc) · 572 Bytes

decisions.md

File metadata and controls

10 lines (8 loc) · 572 Bytes

Decisions

Don't Use Live Data. Prefer SharedFlow

LiveData has the unfortunate requirement that it can only be updated on the main thread. This creates a problem if we need to do any updates while blocking the main thread. Usually we don't want to block the main thread, but there are some cases where we have to (for example onShutdown to ensure we have completed all work needed to save before the shutdown). In addition LiveData changes a NotNull type into a Nullable type.

Instead prefer SharedFlow which can send and receive updates on other threads.