Jun 27, 2022
Instead of using stateIn() in the collect() method which creates an unnecessary StateFlow instance with a single collector, you could just collect the combined Flow then throw an illegal state exception right after, ensuring the method will never return.
Since the source flows are all StateFlows then collect will never return and the exception will not be thrown but the return type will be Nothing.