evaluate abstract method

dynamic evaluate(
  1. String code,
  2. Map<String, dynamic> context
)

Evaluates JavaScript code with the given context.

code - The JavaScript code to execute context - Variables/data available to the JavaScript code

Returns the result of the JavaScript evaluation, or null if evaluation fails.

Example:

final result = evaluator.evaluate(
  'data.price * data.quantity',
  {'data': {'price': 10.0, 'quantity': 5}},
);
print(result); // 50.0

Implementation

dynamic evaluate(String code, Map<String, dynamic> context);