I would suggest to remove the IndexedStack and make the widgets List and render the data based on the index.
List<Widget> _pages = [Home(), Business(),School()];
Make the Provider/Bloc instance on your bottom navigation container widget
return MultiProvider(
providers [
Provider<Something>(create: (_) => Something()),
],
child :Scaffold(
appBar: AppBar(
title: const Text('BottomNavigationBar Sample'),
),
body: _pages[_selectedIndex],
bottomNavigationBar: BottomNavigationBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home),
label: 'Home',
),
BottomNavigationBarItem(
icon: Icon(Icons.business),
label: 'Business',
),
BottomNavigationBarItem(
icon: Icon(Icons.school),
label: 'School',
),
],
currentIndex: _selectedIndex,
selectedItemColor: Colors.amber[800],
onTap: _onItemTapped,
)
)
On each page bind the consumer of the provider, call the api in your provider