flutter_dynamic_forms icon indicating copy to clipboard operation
flutter_dynamic_forms copied to clipboard

More Info Required

Open raphire08 opened this issue 3 years ago • 1 comments

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();`

raphire08 avatar May 10 '21 11:05 raphire08

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

OndrejKunc avatar May 30 '21 14:05 OndrejKunc