title: How to use tabBar controller in flutter?
body: <pre><code>    import 'dart:ffi';
  
      import 'package:flutter/material.dart';
      import 'package:whatsapp_clone/chatScreen.dart';
      class HomePage extends StatefulWidget {
        const HomePage({Key? key}) : super(key: key);
  
        @override
        State&lt;HomePage&gt; createState() =&gt; _HomePageState();
      }
  
      class _HomePageState extends State&lt;HomePage&gt; with SingleTickerProviderStateMixin{
        late TabController  _tabcontroller;
        @override
        void initState(){
          super.initState();
          _tabcontroller=TabController(length: 4, vsync: this, initialIndex: 1);
        }
        @override
        void dispose(){
          _tabcontroller.dispose();
          super.dispose();
        }
        @override
        Widget build(BuildContext context) {
          return Scaffold(
  
            appBar: AppBar(
              backgroundColor:  Color(0xff075E54),
              title: const Text('Whatsapp Clone'),
              actions: [IconButton(onPressed: (){}, icon: const Icon(Icons.search)),
              PopupMenuButton(onSelected: (value){print(value);},
                  itemBuilder: (BuildContext context){return [
                PopupMenuItem(child: Text('New Group'),value: 'New Group'),
                PopupMenuItem(child: Text('New Broadcast'),value: 'New Broadcast'),
                PopupMenuItem(child: Text('Whatsapp web'),value: 'Whatsapp web'),
                PopupMenuItem(child: Text('Starred messages'),value: 'Starred messages'),
                PopupMenuItem(child: Text('Settings'),value: 'Settings')
              ];
              }
              ),
              ],
              bottom: TabBar(
                controller: _tabcontroller,
                tabs: const [
                Tab(icon: Icon(Icons.camera_alt)),
                Tab(text:'CHAT'),
                Tab(text: 'STATUS'),
                Tab(text: 'CALLS')
                ],
                indicatorColor: Colors.white,
              ),
            ),
            body: TabBarView(controller: _tabcontroller,
            children: const [
              Text('camera'),
              ChatPage(),
              Text('status'),
              Text('calls')
            ],
            ),
          );
        }
      }
  </code></pre>
  <p>I want to show the chatscreen which is at 1 index, when opening the app, and i have given the initial index to 1 also, but whenever i open my app, although the chat tabbar was selected but the content was showing from first screen. how can i solve this problem</p>