beat 0.13.0 copy "beat: ^0.13.0" to clipboard
beat: ^0.13.0 copied to clipboard

discontinued
outdated

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
    • addListeners/removeListeners and variations are for state
    • addContextListeners/removeContextListeners is for context
  • ✅ Map states
  • ✅ Execute callback on state change
  • ✅ Support reset
  • ✅ Support context
    • ✅ Initialize with context
    • ✅ Get current context
    • ✅ assign new context
  • ✅ Support transition with an argument
  • ❌ Support nested(compound, hierarchical) state
    • ✅ Define compound state
    • ✅ Using send
    • ✅ Using verbose styled transition via {compoundStateName}Compound field
    • ✅ Multi-level (deeply nested) compound state
    • ❌ Custom initialization on parent state creation
    • ❌ Get current state of compound state using currentState
      • Currently {compundStateName}Compound.currentState is supported
    • ✅ Reset on parent state enter/exit
    • ✅ Reset on parent state reset
  • ✅ Support state change history
  • ✅ Support any state transition
    • ✅ BeatStation with common Beat option
  • ✅ Support state.matches as a is{State}
  • ✅ Support send() styled transition
    • station.send is supported
  • ❌ 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
  • ❌ Support invoking services
    • ✅ async function (or Future)
    • ✅ onDone/onError actions
    • ❌ onDone/onError transitions
      • ✅ to current station
      • ❌ to nested station
    • ❌ callback
    • ❌ observables
    • ❌ other beat station
    • ❌ multiple services
  • ❌ Support instance options
    • ✅ initial state, context
    • ❌ dynamically defined actions, services, delays, guards
  • ✅ Support eventless(always) transition
  • ✅ Support delayed transition
    • ✅ Delay on eventless transition
    • ✅ Delay on send or $event()
  • ❌ Support entry and exit actions
  • ❌ Support conditional (guarded) transition
    • ❌ Support custom functions
    • ❌ Support in state condition
  • ❌ Support internal transition
  • ❌ Support external transition
  • ❌ Support Forbidden transition
  • ❌ Support multiple targets
  • ❌ Support multiple events
  • ❌ Support actors
  • ❌ Support state.nextEvents
  • ❌ Support state.changed
  • ❌ Support state.done
  • ❌ Support state.meta, state.tags
  • ❌ Support state.can
  • ❌ Support history JSON to persist
    • toString() is currently supported
  • ❌ Support parallel state
    • ❌ Define parallel state
    • ❌ Support multiple targets event
  • ❌ Separate interpreter and station
    • ❌ Support pure transition()
  • ❌ Event history with event sourcing
  • ❌ Manually execute actions, execute(state) reference
  • waitFor(state, timeout) method reference
  • ❌ Support scxml
  • ❌ Support bootstrapping
  • ❌ Support CLI/GUI tools
  • ❌ xstate.js compatible beat station

Features not supported by this package but in xstate.js #

  • The final state is naturally defined which does not have any Beat annotation
  • 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
  • ❌ Inspect state, history, event history, next events, etc., from devtools widget inspector
  • ❌ Support remix.run's concept
    • loader
    • action (side effect)
    • ErrorBoundary/CatchBoundary
  • ❌ Support navigation

Usage #

1
likes
0
points
6
downloads

Publisher

verified publisherbeatly.dev

Weekly Downloads

A set of annotations for beat state management. Heavily inspired by xstate.js.org

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

meta

More

Packages that depend on beat