How to show increment of counter in my ui in flutter? : <p>I have declared a variable called ticketCounter that is getting stored in SharedPrefs. This variable is getting incremented and decremented as needed. However I wanted to display this counter on my appBar and want its value to update. Although the value is getting stored in the variable it isn't showing up. </p>

<pre><code>  int tickets;
  void fetchTickets() async {
    SharedPreferences prefs = await SharedPreferences.getInstance();
    tickets = prefs.getInt('ticketRW') ?? 0;
  }
void initState() {
    portraitModeOnly();
    fetchTickets();
    super.initState();
  }

  Widget build(BuildContext context) {
      return Material(
          child: Scaffold(
                   appBar: AppBar(
              actions: &lt;Widget&gt;[
                Padding(
                  padding: const EdgeInsets.only(top: 14, right: 14),
                  child: Text(
                   tickets.toString(),//isn't getting updated
                    style: TextStyle(
                      fontSize: 22,
                      fontFamily: "Netflix",
                      color: Colors.white,
                      fontWeight: FontWeight.w500,
                    ),
                  ),
                ),
               ),
             ),
            }
</code></pre>
