_incrementCounter
inside onPressed
is a function reference, which basically means it is not executed immediately, it is executed after the user clicks on the specific widget.(callback)
_incrementCounter()
is a function call and it is executed immediately.
Therefore, inside onPressed
you can either pass a function reference or an anonymous function…
Top comments (0)