We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Having my 'e' variable exception because of same name with exponential operation
void _expression_creation_and_evaluation() { Parser p = Parser(); Expression exp = p.parse('e'); ContextModel cm = ContextModel(); cm.variables = { 'e': Number(5.0), }; double eval = exp.evaluate(EvaluationType.REAL, cm); print('Expression: $exp'); print('Evaluated expression: $eval\n (with context: $cm)'); // = 1 }
The excetion thrown:
Unhandled exception: RangeError (index): Invalid value: Valid value range is empty: -1 #0 List.[] (dart:core-patch/growable_array.dart:264:36) #1 List.removeLast (dart:core-patch/growable_array.dart:336:20) #2 Parser.parse (package:math_expressions/src/parser.dart:78:44) #3 _expression_creation_and_evaluation (package:luklak_id_mobile/ui/pages/authorized/dashboard/gadgets/count_calculate/count.dart:23:22) #4 main (package:luklak_id_mobile/ui/pages/authorized/dashboard/gadgets/count_calculate/count.dart:11:3) #5 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:297:19) #6 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:192:26)
The text was updated successfully, but these errors were encountered:
Hi @QuangLM75, thanks for your report.
This looks similar to #61 and #35 (including the linked issues there), and mostly stems from limitations of the current parser implementation.
Unfortunately I don't have an easy workaround except creating your expressions programmatically and not using the included parser interface.
Sorry, something went wrong.
No branches or pull requests
void _expression_creation_and_evaluation() { Parser p = Parser(); Expression exp = p.parse('e'); ContextModel cm = ContextModel(); cm.variables = { 'e': Number(5.0), }; double eval = exp.evaluate(EvaluationType.REAL, cm); print('Expression: $exp'); print('Evaluated expression: $eval\n (with context: $cm)'); // = 1 }
Unhandled exception: RangeError (index): Invalid value: Valid value range is empty: -1 #0 List.[] (dart:core-patch/growable_array.dart:264:36) #1 List.removeLast (dart:core-patch/growable_array.dart:336:20) #2 Parser.parse (package:math_expressions/src/parser.dart:78:44) #3 _expression_creation_and_evaluation (package:luklak_id_mobile/ui/pages/authorized/dashboard/gadgets/count_calculate/count.dart:23:22) #4 main (package:luklak_id_mobile/ui/pages/authorized/dashboard/gadgets/count_calculate/count.dart:11:3) #5 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:297:19) #6 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:192:26)
The text was updated successfully, but these errors were encountered: