MutableStateFlow observe and change value from anywhere without creating a coroutine

The talk of Flows, Observable and other solutions is a bit misleading. Looking at these topics, you’re likely to get a lot of responses along the lines of “I’m confused–why would you want that?”.

It seems like you don’t want a sequence of values which is evaluated in a suspending context (i.e. you don’t really want flows). And it seems the core behavior you want is not the ability to observe the change on each variable (although that might be part of the solution).

The feeling is similar to someone asking: “I want to paint my house, which airplane should I buy?” and realizing the person thinks they’re supposed to crop-dust the paint down onto their house.

@arocnies how did you delete your message without a sign? Last time I tried, it was unavailable.
Yep, and I see some of the representatives as adepts of delegates and YAGNI. Delegates because they are lazy.

Roman Elizarov commented 28 Oct 2020 20:22

It is in no way a trivial feature. Even delegation to interfaces has a lot of corner cases in its design. It simply makes no sense to even start working on this (hard) design problem, unless there are strong compelling use-cases.
https://youtrack.jetbrains.com/issue/KT-21955/Allow-delegation-to-classes#focus=Comments-27-4475653.0-0

P.S. Nothing personal, but these delegates s**ks. I spent a lot of time to implement them and then reverted back to interfaces because of override problems. It’s even better to make an init() method in an interface.