WapEvaluator class
Evaluates WapForm expressions (WML $(...), cnd=, value=).
Holds the variables of one card and nearly 600 built-in functions;
custom functions can be added with addFunction*Param. Comparisons on
both sides of AND/OR need parentheses: (qty>0) AND (price<100).
Constructors
Properties
- datasetResolver ↔ ExprDataSet? Function(String name)?
-
Resolves dataset names used in expressions; useEngine sets it to DataSetRegistry.resolveDataSet.
getter/setter pair
- hasError → bool
-
Whether the last evaluation failed.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- lastError ↔ String
-
Error message of the last evaluation ('' when none).
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addFunction0Param(
String name, Func0 fn) → void -
Registers function
namewithout parameters. -
addFunction1Param(
String name, Func1 fn) → void -
Registers function
namewith one parameter. -
addFunction2Param(
String name, Func2 fn) → void -
Registers function
namewith two parameters. -
addFunction3Param(
String name, Func3 fn) → void -
Registers function
namewith three parameters. -
addFunction4Param(
String name, Func4 fn) → void -
Registers function
namewith four parameters. -
addFunctionAParam(
String name, FuncA fn) → void -
Registers function
nametaking any number of arguments. -
clearDataSets(
) → void - Removes every registered dataset.
-
clearVars(
) → void - Clears all variables (keeps built-in functions)
-
cond(
String expr) → bool - Evaluates a condition expression, returns bool. Returns false on failure.
-
eval(
String expr, {bool nul = false}) → dynamic - Evaluates the expression, returns the result. Returns null on failure and sets lastError.
-
evalNul(
String expr) → dynamic - eval's Null mode (corresponds to Expression(Str, True))
-
getUserVars(
) → Map< String, dynamic> - Gets all user-set variables (of type variable/constant)
-
getVar(
String name) → dynamic -
Value of variable
name, or null. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerDataSet(
String name, ExprDataSet ds) → void -
Makes
dsavailable to expressions asname. -
setRow(
String table, Map< String, dynamic> row) → void - Sets a whole row of data at once (the Map's keys are variable names; supports the 'table.field' format)
-
setVar(
String name, dynamic value) → void -
Sets variable
nametovalueas is (not evaluated). -
toString(
) → String -
A string representation of this object.
inherited
-
unregisterDataSet(
String name) → void -
Removes the dataset registered as
name.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited