OndrejKunc / flutter_dynamic_forms

A collection of flutter and dart libraries allowing you to consume complex external forms at runtime.
MIT License
203 stars 59 forks source link

More Info Required #98

Open raphire08 opened 3 years ago

raphire08 commented 3 years ago

Hello, In using the example from usage in Expression Language Library, how to construct the TestFormElement()

`//Create expression parser and pass a map of the types extending ExpressionProviderElement which can hold other expressions.
var expressionGrammarDefinition =
    ExpressionGrammarParser({"element": TestFormElement()});
var parser = expressionGrammarDefinition.build();

//Parse the expression.
var result = parser
    .parse("(1 + @element.value < 3*5) && false || (2 + 3*(4 + 21)) >= 15");

//The expression now contains strongly typed expression tree representing the expression above.
var expression = result.value as Expression<bool>;

//Evaluate the expression.
bool value = expression.evaluate();`
OndrejKunc commented 3 years ago

Hi, good question, it should be included in the documentation - I am adding it to my TODO list. In case you haven't figured it out already, you can see it in the test files, for example: https://github.com/OndrejKunc/flutter_dynamic_forms/blob/445c4c5558f3418f8def468295cd15d8868cddd8/packages/expression_language/test/supporting_files/mocks/test_element.dart