beat 0.8.1
beat: ^0.8.1 copied to clipboard
A set of annotations for beat state management. Heavily inspired by xstate.js.org
It is not product-ready. You should carefully consider using this package in your production environment.
Beat Station - State management with state machine #
This project is my toy project to simplify the state management flows in Flutter and dart. Whole functionalities are heavily inspired by xstate.js.
I highly recommend reading the docs of xstate.js.
Go to the Beatly Book for more information.
Roadmap - Features compatible with xstate.js #
A roadmap is as follows, but the order does not matter.
- ✅ Support simple state transition without context
- ✅ Listen to state and context changes
- ✅ Map states
- ✅ Execute callback on state change
- ✅ Support reset
- ✅ Support context
- ✅ Initialize with context
- ✅ Get current context
- ✅ assign new context
- ✅ Initialize with context
- ✅ Support transition with an argument
- ❌ Support delay
- ❌ Support actions (fire-and-forget)
- ✅ callback action
- ✅ assign action
- ✅ callback action with variable length of arguments
- ❌ choose action
- ❌ forwardTo action
- ❌ log action
- ❌ pure action
- ❌ raise action
- ❌ respond action
- ❌ send action
- ✅ callback action
- ❌ Support invoking services
- ✅ async function (or Future)
- ✅ onDone/onError actions
- ✅ onDone/onError transitions
- ❌ callback
- ❌ observables
- ❌ other beat station
- ❌ multiple services
- ✅ async function (or Future)
- ❌ Support
entryandexitactions - ❌ Support conditional (guarded) transition
- ❌ Support custom functions
- ❌ Support
instate condition
- ❌ Support
- ❌ Support custom functions
- ❌ Support eventless(always) transition
- ❌ Support internal transition
- ❌ Support external transition
- ❌ Support multiple targets
- ✅ Support any state transition
- ✅ BeatStation with common
Beatoption
- ✅ BeatStation with common
- ❌ Support actors
- ✅ Support
state.matchesas ais{State} - ❌ Support
state.nextEvents - ❌ Support
state.changed - ❌ Support
state.done - ❌ Support
state.meta,state.tags - ❌ Support
state.can - ✅ Support state change history
- ❌ Support history JSON to persist
toString()is currently supported
- ❌ Support nested state
- ❌ Support parallel state
- ❌ Define parallel state
- ❌ Support multiple targets event
- ❌ Define parallel state
- ✅ Support
send()ortransition()styled transitionstation.sendis supported
- ❌ Support scxml
- ❌ Support bootstrapping
- ❌ Support CLI/GUI tools
- ❌ xstate.js compatible beat station
Features not supported by this package but in xstate.js #
- The
finalstate is naturally defined which does not have anyBeatannotation state.toString(): naturally supported- wildcard transitions and forbidden transitions are not needed because there will be no typo
Additionals for flutter #
- ❌ Support beat-station-friendly flutter widgets
- ❌ Support
remix.run's concept- ❌
loader- ❌
action(side effect) - ❌
ErrorBoundary/CatchBoundary
- ❌
- ❌
- ❌ Support navigation