A lot of flutter widgets accept actions when a user interacts with a widget such as a raised button which has a onPressed argument.
onPressed arguments accept a function definition or a pointer towards a function that is responsible for the action when the user presses the button.
we can do this by defining a function or using an anonymous function as shown below:
if you are going to define a function make sure it's in the same class that you working on, for e.g in the app below my defined function is called answerQuestion and is defined in MyApp, and it's used in MyApp as well, this is just good practice and it keeps your class methods neat and tidy.
you can use anonymous functions with the arrow => syntax when you have one expression or curly bracket syntax {} when you have more than one expression in your function.