createStore function

dynamic createStore ({List<BaseState> states, List<BaseEffect> effects: const [], bool block: false })

This is the entry point of the ajwah store. You may pass necessay states and effects is optional. Also you can dynamically add or remove state and effect using addState(BaseState stateInstance) ,removeStateByStateName(String stateName), addEffects(BaseEffect effectInstance), addEffect(EffectCallback callback, {@required String key}), removeEffectsByKey(String key)

Implementation

createStore(
    {List<BaseState> states,
    List<BaseEffect> effects = const [],
    bool block = false}) {
  var fx = () {
    _store = Store(states);
    Future.delayed(Duration(seconds: 5));
    effects.forEach((effect) {
      _store.addEffects(effect);
    });
    return _store;
  };
  return block ? fx() : Future.microtask(fx);
}