Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I am trying to use tab controller in flutter how can I access it inside the build context

code image

I am trying to use a tab bar controller , what is the right way to add it

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Just declare the tabController globally inside your state class and initialise it inside init state as you did, then you can access it inside your build method.

late TabController tabController;

void initState(){
   tabController=TabController(vsync:this,length:3); 
}
 

now use accordingly tab controller inside build method.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading