ajwah_bloc library
Classes
-
Action<T>
-
In
Action<T>
generic T used for pauload.
-
Actions
-
used for making effects applying filters on action type(s). [...]
-
BaseEffect
-
Every effect class must derived from
BaseEffect
class. And it is optional to pass the
effectKey
. But it's mandatory if you want conditionally remove the effects by using
store.removeEffectsByKey('effectKey')
[...]
-
BaseState<T>
-
Every state class must derived from
BaseState<T>
class. And it is mandatory to pass the
state name
and initialState
. [...]
-
Store
-
A comfortable way to develop reactive widgets. You can dynamically add or remove effects and states and many more.
Functions
-
addEffect(EffectCallback callback, { String effectKey })
→ void
-
This method is usefull to add a single effect passing a callback (
Actions action$, Store store$)=>Stream and effectKey on demand. [...]
-
addEffects(BaseEffect effectInstance)
→ void
-
This method is usefull to add effects passing effectInstance on demand.
-
addState(BaseState stateInstance)
→ void
-
This method is usefull to add a state passing stateInstance on demand.
-
createStore({List<BaseState> states, List<BaseEffect> effects: const [], bool block: false })
→ dynamic
-
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)
-
dispatch(String actionType, [ dynamic payload ])
→ void
-
This is a helper function of store().dispatch(Action action).
-
exportState()
→ Stream<List>
-
return latest stream of
action, state
array. [...]
-
getStore()
→ Store
-
return Store instance.
-
importState(Map<String, dynamic> state)
→ void
-
state object should be a Map<String, dynamic> state [...]
-
latestState(BaseState obj)
→ dynamic
-
return latest state data by state obj.
-
removeEffectsByKey(String effectKey)
→ void
-
This method is usefull to remove effects passing effectKey on demand.
-
removeStateByStateName(String stateName)
→ void
-
This method is usefull to remove a state passing stateName on demand.
-
select<T>(String stateName)
→ Stream<T>
-
This is a helper function of store().select(String stateName). [...]
-
select2<T>(T callback(Map<String, dynamic> state))
→ Stream<T>
-
This method takes a callback which has a single Map<String, dynamic> type arg.
If you pass Map key as a state name then you will get corresponding model instance
as value. [...]