class StatefulWidget{ FlatButton( onPressed: (){ Something.counter++; // This variable is your counter you mentioned earlier } ); }
class Something { static int counter; }