📱 Flutter Intermediate

What is TabBar in Flutter?

Why Interviewers Ask This

Mid-level Flutter roles require deep understanding of this topic. Interviewers ask this to separate candidates who truly understand the mechanics from those who only know surface-level concepts.

Answer

TabBar displays a horizontal row of tab indicators (text or icons) for switching between related views. It works with DefaultTabController (simple) or a TabController (programmatic control). Place the TabBar in the bottom property of an AppBar and a TabBarView in the Scaffold body. The TabController synchronizes the tab selection with the displayed view. Each Tab in the TabBar corresponds to a child in the TabBarView.

Pro Tip

Before answering, structure your response: one-line definition → real-world analogy → concrete example from a project. This makes even complex Flutter answers easy to follow.