Flutter

Flutter Fundamentals

Widgets, StatelessWidget, StatefulWidget, widget tree, build method, hot reload

18 interview questionsยท
Junior
1

What is a widget in Flutter?

Answer

In Flutter, everything is a widget. A widget is an immutable description of part of the user interface. Widgets describe what their view should look like given their current configuration and state. Flutter uses these descriptions to build the element tree that manages the on-screen rendering.

2

What is the main difference between StatelessWidget and StatefulWidget?

Answer

A StatelessWidget is immutable and cannot change after creation. It is used for UI elements that do not change dynamically. A StatefulWidget can maintain mutable state through an associated State object, allowing the UI to rebuild in response to state changes.

3

Which method must be implemented in every widget to define its user interface?

Answer

The build() method is mandatory in all Flutter widgets. It receives a BuildContext as a parameter and returns a Widget that describes the user interface. This method is called whenever the framework needs to rebuild the widget, for example after a setState() call in a StatefulWidget.

4

What is the widget tree in Flutter?

5

What is the difference between hot reload and hot restart in Flutter?

+15 interview questions

Master Flutter for your next interview

Access all questions, flashcards, technical tests, code review exercises and interview simulators.

Start for free