Skip to content

Replace Nothing with Unit in processor state

Compare
Choose a tag to compare
@tomczyn tomczyn released this 26 Apr 12:48
· 19 commits to main since this release
16cf18c

Coroutines 1.6 changed internal implementation of StateFlow and now it's impossible to implement StateFlow with Nothing type. Workaround is to use Unit type instead of Nothing to represent no meaningful state in processor.

Migration

Replace Nothing with Unit

val processor: Processor<MyEvent, Nothing, MyEffect> = processor(
    prepare = { ... },
    onEvent = { ... }
)
val processor: Processor<MyEvent, Unit, MyEffect> = processor(
    prepare = { ... },
    onEvent = { ... }
)