Description
We could achieve a nice intent handler DSL by building a FlowMVI plugin to replace reduce with a more robust handler, and additionally, give users an easier way to split their reducers apart (even though that'd make it less safe).
Example:
reducer {
on<CounterIntent.Increment> {
distinct() // default equals, allow customizing, similar to compose remember
filter { it.value > 2 }
mode = Cancel // what happens when queue builds up
handle {
updateState { copy(counter = counter++) }
} // consider requiring handler builder return type from this lambda
}
}
Requirements: