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