callNode method

Future<Map<String, dynamic>> callNode({
  1. required String nodeId,
  2. required Map<String, RuleNode> nodes,
  3. required Map<String, dynamic> context,
})

Implementation

Future<Map<String, dynamic>> callNode({
  required String nodeId,
  required Map<String, RuleNode> nodes,
  required Map<String, dynamic> context,
}) async {
  checkLoops();

  final node = nodes[nodeId];
  if (node == null) {
    throw Exception("Node $nodeId not found");
  }

  // Get resolved input controls
  final resolvedInputs = await getResolvedInputControls(node, nodes, context);

  // Call the node function
  final result = await fireNodeFunction(
    node.type,
    resolvedInputs,
    context,
  );

  return _castToStringMap(result) ?? {};
}