title: How to re-build Page A when a button is pressed in Page B?
body: <p>I'm working with IndexedStack in order not to rebuild each page while using <code>BottomNavigationBar</code></p>
  <pre class="lang-dart prettyprint-override"><code>// MAIN.DART
  class LoggedHandle extends StatefulWidget {
    const LoggedHandle({Key? key}) : super(key: key);
  
    @override
    State&lt;LoggedHandle&gt; createState() =&gt; _LoggedHandleState();
  }
  
  class _LoggedHandleState extends State&lt;LoggedHandle&gt; {
    
  
   
    double height = AppBar().preferredSize.height;
  
    int _selectedPage = 1;
  
  
  
   
    
  
    @override
    void initState() {
      
      });
  
  
  
      super.initState();
    }
  
    @override
    void dispose() {
  
      _importo.dispose();
      super.dispose();
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        
         
          
  
        bottomNavigationBar: BottomNavigationBar(
            
            currentIndex: _selectedPage,
            onTap: (int index) {
              setState(() {
                _selectedPage = index;
              });
            },
            items: const &lt;BottomNavigationBarItem&gt;[
              BottomNavigationBarItem(
                icon: Icon(Icons.receipt),
                label: 'Schedina',
              ),
              BottomNavigationBarItem(
                icon: Icon(Icons.home),
                label: 'Home',
              ),
              BottomNavigationBarItem(
                icon: Icon(Icons.account_circle),
                label: 'Account',
              ),
            ]),
        body: IndexedStack(
          index: _selectedPage,
          children:  [BetView(), HomeView(), UserView()],
        ),
      );
    }
  
  
  }
  </code></pre>
  <pre class="lang-dart prettyprint-override"><code>
  // HOME.DART
  
  class HomeView extends StatefulWidget {
    const HomeView({Key? key}) : super(key: key);
  
    @override
    State&lt;HomeView&gt; createState() =&gt; _HomeViewState();
  }
  
  class _HomeViewState extends State&lt;HomeView&gt; {
  
    
  
  
    @override
    void initState() {
  
      super.initState();
      
    }
  
    @override
    Widget build(BuildContext context) {
      return SizedBox.expand(
        child: SingleChildScrollView(
          child: Column(
            children: [
  
  
              Padding(
                child: Text(&quot;rebuild this&quot;)
              ),
              
  
            ],
          ),
        ),
      );
    }
  }
  
  </code></pre>
  <p>In <code>BetView()</code> I have a <code>ElevatedButton</code> and I would like to rebuild <code>HomeView</code> when it is pressed. Navigation to <code>HomeView()</code> won't rebuild it because of <code>IndexedStack</code></p>
  <pre class="lang-dart prettyprint-override"><code>// BETVIEW
  class BetView extends StatefulWidget {
    const BetView({Key? key}) : super(key: key);
  
    @override
    State&lt;BetView&gt; createState() =&gt; _BetViewState();
  }
  
  class _BetViewState extends State&lt;BetView&gt; {
  
  
    late final TextEditingController _importo;
    
  
    @override
    void initState() {
     
        
  
  
  
      super.initState();
    }
  
    @override
    void dispose() {
  
      
      super.dispose();
    }
    @override
    Widget build(BuildContext context) {
      return BlocBuilder&lt;BetBloc, BetState&gt;(
        builder: (context, state) {
          if (state is BetLoaded) {
            double quotatotale = 1.0;
  
  
            for (BetEntry bet in state.bets) {
              print(bet);
              quotatotale = quotatotale * bet.quota;
            }
            return Column(
              children: [
                
                
                              
                
                Padding(
                  padding: const EdgeInsets.all(10.0),
                  child: Row(
                    children: [
                      ElevatedButton(
                        style: ButtonStyle(
                            backgroundColor: MaterialStateProperty.all(Colors.orange[500]),
                            shape: MaterialStateProperty.all&lt;RoundedRectangleBorder&gt;(
                                RoundedRectangleBorder(
                                  borderRadius: BorderRadius.circular(8.0),
                                )
                            )
                        ),
                        onPressed: (){
                          
                          // Rebuild HomeView()
                        },
                        child: const Padding(
                          padding: EdgeInsets.all(15),
                          child: Text(&quot;Elimina tutte&quot;,
                            style: TextStyle(
                                fontSize: 15,
                                color: Colors.white,
                            ),
                          ),
                        ),
                      ),
                      const Spacer(),
                      ElevatedButton(
                        style: ButtonStyle(
                            backgroundColor: MaterialStateProperty.all(Colors.green),
                            shape: MaterialStateProperty.all&lt;RoundedRectangleBorder&gt;(
                                RoundedRectangleBorder(
                                  borderRadius: BorderRadius.circular(8.0),
                                )
                            )
                        ),
                        onPressed: (){
  
                        },
                        child: const Padding(
                          padding: EdgeInsets.all(15),
                          child: Text(&quot;Conferma&quot;,
                            style: TextStyle(
                                fontSize: 15
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
              ],
            );
          } else {
            return const Text(&quot;something wrong&quot;);
          }
        },
      );
    }
  }
  </code></pre>