FormulaEngine class

Main entry point for the formula engine.

Use this class to parse and evaluate spreadsheet formulas.

final engine = FormulaEngine();

// Parse a formula
final ast = engine.parse('=SUM(A1:A10)');

// Evaluate with your data source
final result = engine.evaluate(ast, myContext);

Constructors

FormulaEngine({FunctionRegistry? functions})
Create a new formula engine.

Properties

functions FunctionRegistry
Get the function registry.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clearCache() → void
Clear the parse cache.
evaluate(FormulaNode ast, EvaluationContext context) FormulaValue
Evaluate a parsed formula with the given context.
evaluateString(String formula, EvaluationContext context) FormulaValue
Parse and evaluate a formula string.
getCellReferences(String formula) Set<A1>
Get all cell references in a formula (for dependency tracking).
isValidFormula(String formula) bool
Check if a string is a valid formula.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parse(String formula) FormulaNode
Parse a formula string into an AST.
registerFunction(FormulaFunction function) → void
Register a custom function.
toString() String
A string representation of this object.
inherited
tryParse(String formula) FormulaNode?
Try to parse a formula, returning null on failure.

Operators

operator ==(Object other) bool
The equality operator.
inherited