Flutter - evaluate string with variable and functionname

Multi tool use
up vote
0
down vote
favorite
i am trying to evaluate a string like "pow(x, 2) * y" in Flutter.
Example Code:
Double x = 2.34;
Double y = 2.10;
String formular = "pow(x, 2) * y";
Now i would like to evaluate the string to get the result of:
pow(2.34, 2) * 2.10;
Is there a way to do this?
I tried to work with https://pub.dartlang.org/packages/expressions, but couldn't figure out how to solve my problem.
I am thankful for any help.


New contributor
tbs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
0
down vote
favorite
i am trying to evaluate a string like "pow(x, 2) * y" in Flutter.
Example Code:
Double x = 2.34;
Double y = 2.10;
String formular = "pow(x, 2) * y";
Now i would like to evaluate the string to get the result of:
pow(2.34, 2) * 2.10;
Is there a way to do this?
I tried to work with https://pub.dartlang.org/packages/expressions, but couldn't figure out how to solve my problem.
I am thankful for any help.


New contributor
tbs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
3
The example in the readme of theexpressions
package looks quite similar to what you have. What problem did you run into when you tried? Please add the code to your question that demonstrates what you tried and the error messages you got.
– Günter Zöchbauer
Nov 9 at 14:09
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
i am trying to evaluate a string like "pow(x, 2) * y" in Flutter.
Example Code:
Double x = 2.34;
Double y = 2.10;
String formular = "pow(x, 2) * y";
Now i would like to evaluate the string to get the result of:
pow(2.34, 2) * 2.10;
Is there a way to do this?
I tried to work with https://pub.dartlang.org/packages/expressions, but couldn't figure out how to solve my problem.
I am thankful for any help.


New contributor
tbs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
i am trying to evaluate a string like "pow(x, 2) * y" in Flutter.
Example Code:
Double x = 2.34;
Double y = 2.10;
String formular = "pow(x, 2) * y";
Now i would like to evaluate the string to get the result of:
pow(2.34, 2) * 2.10;
Is there a way to do this?
I tried to work with https://pub.dartlang.org/packages/expressions, but couldn't figure out how to solve my problem.
I am thankful for any help.




New contributor
tbs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
tbs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
tbs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked Nov 9 at 14:07
tbs
11
11
New contributor
tbs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
tbs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
tbs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
3
The example in the readme of theexpressions
package looks quite similar to what you have. What problem did you run into when you tried? Please add the code to your question that demonstrates what you tried and the error messages you got.
– Günter Zöchbauer
Nov 9 at 14:09
add a comment |
3
The example in the readme of theexpressions
package looks quite similar to what you have. What problem did you run into when you tried? Please add the code to your question that demonstrates what you tried and the error messages you got.
– Günter Zöchbauer
Nov 9 at 14:09
3
3
The example in the readme of the
expressions
package looks quite similar to what you have. What problem did you run into when you tried? Please add the code to your question that demonstrates what you tried and the error messages you got.– Günter Zöchbauer
Nov 9 at 14:09
The example in the readme of the
expressions
package looks quite similar to what you have. What problem did you run into when you tried? Please add the code to your question that demonstrates what you tried and the error messages you got.– Günter Zöchbauer
Nov 9 at 14:09
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
tbs is a new contributor. Be nice, and check out our Code of Conduct.
tbs is a new contributor. Be nice, and check out our Code of Conduct.
tbs is a new contributor. Be nice, and check out our Code of Conduct.
tbs is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53227274%2fflutter-evaluate-string-with-variable-and-functionname%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
K,j43P0iu NYCDY,Moz 4,5ntJVOs pCVr7,Nav
3
The example in the readme of the
expressions
package looks quite similar to what you have. What problem did you run into when you tried? Please add the code to your question that demonstrates what you tried and the error messages you got.– Günter Zöchbauer
Nov 9 at 14:09