Ok I\'m pretty new to flutter/ dart so go easy on me. I\'m just trying to make a very simple app where when you press a button some text updates telling you how many times
Your problem is that you didn't pass a callback to RaisedButton
, you invoked your callback.
new RaisedButton(
onPressed: _buttonWasPressed(), // invokes function
child: new Row(children: [new Text("Press meh")]),
);
To pass a callback to another widget you have two choices:
new RaisedButton(
onPressed: _buttonWasPressed, // no `()`,
child: ...
)
new RaisedButton(
onPressed: () {
// do something.
},
..
)