What does the runApp() function do?

Why Interviewers Ask This

Foundational questions like this help interviewers calibrate the rest of the interview. A confident, accurate answer signals that you have solid Flutter basics — a prerequisite for any developer role.

Answer

runApp() is the starting point of every Flutter application. It takes a root widget and inflates it to fill the entire screen, making it the root of the widget tree. It is called inside the main() function, which is Flutter's entry point. Example: void main() => runApp(MyApp());. The framework then calls build() on the root widget to construct the initial UI.

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.