getValueFunction<T> method
ActionValueFunction<T> ?
getValueFunction<T>(
- BuildContext context,
- dynamic actionSpec,
- Map state,
- Map? evaluatorContext,
Returns a ActionValueFunction<T> that executes an Action based on it's actionSpec
.
Implementation
ActionValueFunction<T>? getValueFunction<T>(BuildContext context,
dynamic actionSpec, Map state, Map? evaluatorContext) {
if (actionSpec == null) return null;
if (EditorBloc.editMode) return (v) {};
if (actionSpec is ActionValueFunction<Object?>) return actionSpec;
final nodeSpec =
actionSpec is NodeSpec ? actionSpec : NodeSpec.fromMap(actionSpec);
return (val) {
if (actionSpec != null) {
run(context, nodeSpec, state, val, evaluatorContext);
}
};
}