felangel / flow_builder

Flutter Flows made easy! A Flutter package which simplifies navigation flows with a flexible, declarative API.
https://pub.dev/packages/flow_builder
MIT License
389 stars 63 forks source link

.set in addition to .update #80

Open VKBobyr opened 2 years ago

VKBobyr commented 2 years ago

Is your feature request related to a problem? Please describe. Whenever I want to transition to a new flow state without caring about the current flow state, I don't want to write more code of the form:

context
    .flow<StateClass>()
    .update((currentStateIDontCareAbout) => NewState())

Describe the solution you'd like I'd like to see a more consise version of the form:

context
    .flow<StateClass>()
    .set(NewState())

This isn't a big deal -- just seems like a natural function to have.

PS. I know I can use .update((_) => NewState()) to make it more concise, but I'd just pass in the state directly.