Hopefully this is an easy one, but I'm a complete newbie to Flutter. I'm wondering how to reset a Widget's variable to its default, say when a button is pressed. I know I can hard code it (as I have in the example below), but surely there's a smarter way to simply have it reset to its default without explicitly setting it to the same value?
Thank you for any help!
class WidgetTest extends StatefulWidget {
  static const String id = 'widgettest_screen';
  @override
  _WidgetTestState createState() => _WidgetTestState();
}
class _WidgetTestState extends State<WidgetTest> {
  int _variable = 0;
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: <Widget>[
          Text('$_variable'),
          IconButton(
            icon: Icon(
              Icons.add,
            ),
            onPressed: () {
              setState(() {
                _variable++;
              });
            },
          ),
          IconButton(
            icon: Icon(
              Icons.refresh,
            ),
            onPressed: () {
              setState(() {
                _variable = 0;
              });
            },
          )
        ],
      ),
    );
  }
}
 
    