how can I call a function when the user presses a key from the keyboard ?
This is for Desktop development .
CodePudding user response:
You can do it using Actions and shortcuts in flutter. These widgets work something like this :
To get a more detailed information, please refer to the flutter docs here. These come under Advanced UI concepts.
CodePudding user response:
I imagine you're using a TextField? It has the following property onChanged: ((newText) => {})
You can go ahead and use it like this:
onChanged: ((newText) => { yourFunction; }),
or
onChanged: ((newText) => { setState((){yourFunction;}); }),
Just to clarify, this will only update when the text changes. @Divyam Dhadwal seems to have a wild answer that might be more useful
Good luck my man! xx