Skip to content
A simple state machine implementation in flutter.
Dart Objective-C Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
android
ios
lib
.gitignore
.metadata
README.md
pubspec.lock
pubspec.yaml
state-machine.png

README.md

Finite State Machine

A finite state machine (sometimes called a finite state automaton) is a computation model that can be implemented with hardware or software and can be used to simulate sequential logic and some computer programs. Finite State Machine helps a lot in User Interface flow. xstate is a popular javascript library to create a state machine. It can be used along with modern libraries like React or Vue for maximum effeciency. In this repository I created a simple state machine implementation for stopwatch in Flutter.

alt text

var stopwatchStateMachine = StateMachine({
  'running': State([
    Transition(action: 'pause', targetState: 'idle'),
    Transition(action: 'stop', targetState: 'initial')
  ]),
  'idle': State([
    Transition(action: 'start', targetState: 'running'),
    Transition(action: 'stop', targetState: 'initial')
  ]),
  'initial': State([
    Transition(action: 'start', targetState: 'running')
  ])
}, 'initial');

Detailed information available here.

You can’t perform that action at this time.