onIf method

Future<SilentActionResult> onIf(
  1. NodeSpec action,
  2. ActionContext context
)

Implementation

Future<SilentActionResult> onIf(
    NodeSpec action, ActionContext context) async {
  final condition = action.props["condition"];
  if (condition == null) {
    return SilentActionResult(true);
  }

  final actions = action.actions;
  final result = Lowder.properties.evaluateCondition(condition);
  Map? nextAction = result ? actions["onTrue"] : actions["onFalse"];

  // final props = action.props;
  // final result = Lowder.properties
  //     .evaluateOperator(props["left"], props["operator"], props["right"]);

  return SilentActionResult(true, nextAction: nextAction);
}