FlutterBasic 3 min read

Flutter basic interview questions with practical answers

Prepare clear answers about Flutter, Dart, widget identity, state and layout, with a code-reading exercise and follow-up prompts.

On this page

Use each answer as a starting point, not a script to recite. A strong response gives a definition, a small example and one boundary or limitation.

Use the broader FlutterFever interview preparation guide to connect these explanations with a project discussion.

What is the difference between Flutter and Dart?

Dart is the programming language. Flutter is an application UI toolkit built around Dart libraries, tools and an engine. A class or async function can be Dart-only; Scaffold and Widget are Flutter APIs. Follow-up: which platform work still remains in a shared-codebase app?

What is a widget?

A widget is an immutable description of part of an interface. Flutter can use it to update the underlying element and render-object structures. Avoid saying that every rebuild destroys and recreates the entire native screen.

StatelessWidget versus StatefulWidget?

A StatefulWidget has a separate State object for mutable state across compatible updates. A StatelessWidget can still rebuild when its inputs or dependencies change. “Stateless never changes” is not an accurate explanation.

What does setState do?

Its callback performs a synchronous state mutation and marks the relevant element for rebuilding. It does not directly redraw a text label or asynchronously save data. Keep long-running work outside that callback.

What is BuildContext?

It describes a location in the element tree and lets APIs look up ancestors or inherited dependencies. The location matters: a context above a provider cannot look downward into a provider created below it.

Why use Expanded in a Row?

It gives a child a tight share of remaining main-axis space. Flexible can allow a looser fit. Explain the parent’s constraints before prescribing either widget as a universal overflow fix.

What do keys identify?

Keys help match widgets with existing elements among compatible siblings. Stable data IDs are useful for reorderable stateful rows. A list index changes meaning when items move.

Why dispose controllers?

The object that creates a controller or subscription should release the resources it owns. This avoids leaks and callbacks into a disposed feature. Ownership is more precise than calling dispose on every object you can reach.

Code-reading question

What is preserved after hot reload if the user has already incremented a State field? Explain why changing its initializer may require a restart before that new initial value is observed.

Turn an answer into a short demonstration

Pick one answer and prove it with a small change. For StatelessWidget, pass a different constructor value from the parent. For setState, show the value owner and the event that updates it. For a key, reorder two stateful items and observe which identity should remain stable.

Then name the limitation of the example. A counter explains a local update but does not prove a complete authentication architecture. Being precise about scope is stronger than claiming the demo covers every production concern.

Use the first app and widget identity for demonstrations you can explain without memorizing a script.

Practice and verification

Explain the first app without reading the code. Name the state owner, the event that changes it and the widgets that render it. Then demonstrate one lifecycle or layout mistake and its correction.

How this topic connects

Understand first

Apply it next

Lesson progressMark complete after checking the example and exercise.

Find your next idea

Search lessons, code examples and projects.

Type a few words to start exploring.