for example, I want to write "5 + 3" in text field in flutter app, then press enter, after that, I want from application to convert the input to the result, I mean convert "5 + 3" to "8".
is there any way to do that in flutter?
thanks in advance for the help.
I searched about way in google, but did not find any thing.
2
Answers
You can use this function to calculate your example field and improve it for your needs.
You can make a
TextField
that calls an evaluation function when user submit the input, by having the evaluation inside the callback ofonSubmitted
. After that, set theTextField
‘s controller text to the result of the evaluation. To evaluate the calculation from the input, you can use a package like math_parser.