Basics of Flutter


Basics of Flutter Interview with follow-up questions

1. What is Flutter and why is it used?

Flutter is Google's open-source UI toolkit for building natively compiled apps for mobile (iOS/Android), web, desktop (Windows/macOS/Linux), and embedded devices from a single Dart codebase. It's used because:

  • One codebase, consistent UI: Flutter ships its own rendering engine (Impeller) and draws every pixel itself rather than wrapping native OEM widgets, so the UI looks and behaves identically across platforms.
  • Fast iteration: stateful hot reload injects code changes into the running app in well under a second while preserving state.
  • Native performance: Dart compiles ahead-of-time (AOT) to native ARM/x64 in release builds — no JavaScript bridge, no interpreter.
  • Rich, composable widgets: a large Material and Cupertino widget library, plus everything-is-a-widget composition.

A common follow-up is "when would you NOT pick Flutter?" — apps that need deep platform-specific look-and-feel, very small binary size, or heavy native SDK integration may still favor native; and Flutter web is best for app-like experiences rather than SEO-critical content sites.

↑ Back to top

Follow-up 1

What are some of the advantages of using Flutter?

Some of the advantages of using Flutter are:

  • Cross-platform development: Flutter allows developers to build applications for multiple platforms using a single codebase, which reduces development time and effort.

  • Fast development: Flutter's hot reload feature allows developers to see the changes in the app instantly, making the development process faster and more efficient.

  • Beautiful and responsive UI: Flutter provides a rich set of pre-designed widgets and tools that enable developers to create visually appealing and responsive user interfaces.

  • Performance: Flutter's architecture and rendering engine enable high-performance applications with smooth animations and fast rendering.

  • Open-source and active community: Flutter is open-source, which means it has a large and active community of developers who contribute to its development and provide support and resources.

Follow-up 2

Can you mention some of the disadvantages of Flutter?

Some of the disadvantages of using Flutter are:

  • Limited third-party libraries: Flutter is a relatively new framework, so it may have a limited number of third-party libraries and packages compared to more established frameworks like React Native.

  • Learning curve: Flutter uses the Dart programming language, which may require developers to learn a new language if they are not familiar with it. This can increase the learning curve for developers who are new to Flutter.

  • Platform-specific features: Flutter's cross-platform nature means that it may not have access to all the platform-specific features and APIs of each platform. Developers may need to write platform-specific code or use plugins to access certain features.

  • App size: Flutter apps tend to have a larger file size compared to native apps, as they include the Flutter engine and framework libraries.

  • Limited tooling support: While Flutter has a growing ecosystem of tools and plugins, it may still have limited tooling support compared to more mature frameworks.

Follow-up 3

How does Flutter compare with other mobile development frameworks?

Flutter has several advantages over other mobile development frameworks:

  • Performance: Flutter's architecture and rendering engine enable high-performance applications with smooth animations and fast rendering.

  • Hot reload: Flutter's hot reload feature allows developers to see the changes in the app instantly, making the development process faster and more efficient.

  • Cross-platform development: Flutter allows developers to build applications for multiple platforms using a single codebase, which reduces development time and effort.

  • UI flexibility: Flutter provides a rich set of pre-designed widgets and tools that enable developers to create visually appealing and responsive user interfaces.

  • Open-source and active community: Flutter is open-source and has a large and active community of developers who contribute to its development and provide support and resources.

However, it also has some limitations compared to other frameworks, such as a limited number of third-party libraries, a learning curve for developers new to Dart, and potential limitations in accessing platform-specific features and APIs.

2. What language does Flutter use for development?

Flutter uses Dart, an open-source, statically typed language by Google. Interviewers usually expect a bit more than the name: Dart is optimized for UI work, supports both JIT compilation (powering hot reload in debug) and AOT compilation to native machine code (release builds), and includes sound null safety plus modern Dart 3 features like records, patterns, and sealed classes.

↑ Back to top

Follow-up 1

What are the advantages of using this language?

Some advantages of using Dart programming language for Flutter development are:

  • Productivity: Dart has a simple and clean syntax which makes it easy to learn and write code quickly.
  • Hot Reload: Dart's hot reload feature allows developers to see the changes in real-time, making the development process faster and more efficient.
  • Performance: Dart is compiled to native code, which results in fast and efficient performance.
  • Asynchronous Programming: Dart has built-in support for asynchronous programming, making it easier to handle asynchronous operations like network requests and file I/O.
  • Flutter Integration: Dart is the primary language for Flutter development, so it has excellent integration with the Flutter framework.

Follow-up 2

How does this language support Flutter's performance?

Dart programming language supports Flutter's performance in the following ways:

  • Just-in-Time (JIT) Compilation: During development, Dart uses JIT compilation, which allows for hot reload and fast iteration. This helps developers to quickly see the changes they make in real-time.
  • Ahead-of-Time (AOT) Compilation: When building a release version of the app, Dart uses AOT compilation, which compiles the Dart code to highly optimized native code. This results in faster startup times and improved performance.
  • Efficient Garbage Collection: Dart's garbage collector is optimized for Flutter, ensuring efficient memory management and reducing the chances of performance issues.
  • Isolates: Dart supports isolates, which are lightweight threads that can run in parallel. This allows Flutter to perform tasks concurrently and improve overall performance.

Follow-up 3

What are some key features of this language that make it suitable for Flutter?

Some key features of Dart programming language that make it suitable for Flutter are:

  • Strong Typing: Dart is a statically typed language, which helps catch errors at compile-time and improves code reliability.
  • Object-Oriented Programming: Dart supports object-oriented programming concepts like classes, inheritance, and interfaces, making it easier to organize and structure code.
  • Asynchronous Programming: Dart has built-in support for asynchronous programming, which is crucial for developing responsive and performant Flutter applications.
  • Garbage Collection: Dart has automatic garbage collection, which simplifies memory management and reduces the chances of memory leaks.
  • Interoperability: Dart can interoperate with native code, allowing developers to use existing platform-specific APIs and libraries when needed.

3. What is the Dart platform?

The Dart platform is Google's programming language plus its toolchain and runtime for building high-performance, cross-platform apps (mobile, web, desktop, server, command-line). What makes it well suited to Flutter is its dual compilation model:

  • JIT (just-in-time) compilation in debug, run on the Dart VM — this is what enables stateful hot reload.
  • AOT (ahead-of-time) compilation to native ARM/x64 machine code for release builds, giving fast startup and predictable performance with no interpreter or JavaScript bridge.

For web, Dart compiles to JavaScript or, increasingly, to WebAssembly. Modern Dart (Dart 3+) adds sound null safety, records, patterns and pattern matching, and sealed/class modifiers — features interviewers may probe as "what's new in Dart."

↑ Back to top

Follow-up 1

How does Dart support Flutter development?

Dart is the primary programming language used for developing Flutter applications. Flutter is a UI toolkit for building natively compiled applications for mobile, web, and desktop from a single codebase. Dart's features like hot reload, declarative UI, and reactive programming make it a great fit for building Flutter apps.

Follow-up 2

What are some key features of Dart?

Some key features of Dart include:

  • Strong typing: Dart is a statically typed language, which means that variables have types that are checked at compile-time.
  • Garbage collection: Dart has automatic memory management, so developers don't need to worry about manual memory deallocation.
  • Asynchronous programming: Dart has built-in support for asynchronous programming using features like async/await and Future objects.
  • Hot reload: Dart's hot reload feature allows developers to quickly see the changes they make to their code without having to restart the application.
  • Declarative UI: Dart supports building UIs using a declarative syntax, which makes it easier to build and maintain complex user interfaces.

Follow-up 3

How does Dart compare with other languages like JavaScript or Kotlin?

Dart has some similarities with JavaScript and Kotlin, but also has some unique features. Here are some comparisons:

  • Syntax: Dart has a C-style syntax, similar to JavaScript and Kotlin.
  • Type system: Dart is a statically typed language, like Kotlin, but unlike JavaScript which is dynamically typed.
  • Performance: Dart is designed to be a high-performance language, and it can be compiled to native code for better performance. JavaScript is an interpreted language, while Kotlin can be compiled to native code or run on the JVM.
  • Platform support: Dart is primarily used for building Flutter applications, while JavaScript is used for web development and Kotlin is used for Android development.

Overall, Dart offers a combination of performance, strong typing, and cross-platform support that makes it a good choice for building modern applications.

4. What is the architecture of Flutter?

Flutter uses a layered architecture with three main layers, each built on the one below and independently replaceable:

  1. Framework (Dart) — the layer you code against. From top to bottom: Material/Cupertino, Widgets, Rendering, Animation/Painting, and Foundation. This is where the reactive widget model lives.
  2. Engine (C++) — provides the low-level primitives: the Impeller rasterizer (which replaced Skia on mobile), the Dart runtime, text layout, and platform-channel plumbing.
  3. Embedder (platform-specific) — the host glue that gives Flutter a surface to render to, an event loop, and access to services on each OS (Android, iOS, Windows, macOS, Linux, web, embedded).

The key follow-up is the three trees: the Widget tree (immutable configuration), the Element tree (manages lifecycle and links widgets to render objects), and the RenderObject tree (does layout, painting, hit testing). Understanding why widgets are immutable and how Elements diff/reuse them is what separates a strong answer from a memorized one.

↑ Back to top

Follow-up 1

Can you explain the role of the Flutter engine?

The Flutter engine is responsible for rendering the UI and handling user input. It is written in C++ and provides a platform-independent interface to the underlying operating system. The engine takes the high-level UI description provided by the framework and converts it into a series of low-level drawing commands that are then executed by the graphics hardware. It also handles user input events such as touch, gestures, and keyboard input, and forwards them to the framework layer for processing.

Follow-up 2

How does the framework architecture support the development of applications?

The framework layer in Flutter provides a set of high-level APIs and services that make it easy to build beautiful and responsive user interfaces. It includes a rich set of pre-built widgets that can be customized and composed together to create complex UI layouts. The framework also provides APIs for handling user input, managing state, handling animations, and more. It follows a reactive programming model, where changes to the UI are automatically reflected in response to changes in the underlying data or state.

Follow-up 3

What is the role of widgets in Flutter architecture?

Widgets are the building blocks of the user interface in Flutter. They define the structure and appearance of the UI elements. Widgets can be either stateless or stateful. Stateless widgets are immutable and their appearance is solely based on the configuration information they receive. Stateful widgets, on the other hand, can change their appearance based on the current state of the application. Widgets can be composed together to create complex UI layouts, and they can also be animated, transformed, and styled to create visually appealing interfaces.

5. What are widgets in Flutter?

In Flutter, widgets are the immutable building blocks of the UI — "everything is a widget," from a button or padding to the app itself. A widget is just a lightweight description (configuration) of part of the UI; Flutter inflates it into an Element and a RenderObject to actually lay out and paint it.

Widgets come in two main kinds:

  • StatelessWidget — immutable, no internal mutable state. It rebuilds only when its inputs change.
  • StatefulWidget — pairs with a separate State object that holds mutable state; calling setState() schedules a rebuild.

The gotcha interviewers look for: the widget itself is always immutable even for StatefulWidget — the mutable part lives in the associated State object, which is why Flutter can cheaply rebuild and diff widget trees. There are also InheritedWidget (propagates data down the tree; backs Theme, MediaQuery, Provider) and RenderObjectWidget (custom layout/paint) for when the two basic kinds aren't enough.

↑ Back to top

Follow-up 1

What is the difference between Stateless and Stateful widgets?

The main difference between stateless and stateful widgets is that stateless widgets are immutable, while stateful widgets can change their properties and update their appearance. Stateless widgets are used for displaying static content that does not change over time, while stateful widgets are used for displaying dynamic content that can change based on user interactions or other events.

Follow-up 2

How are widgets used in Flutter?

Widgets are used in Flutter to build the user interface. They can be combined and nested together to create complex UI layouts. Each widget represents a specific element on the screen, such as a button, text, image, or container. Widgets can also have properties that define their appearance and behavior. By composing and arranging widgets, developers can create visually appealing and interactive user interfaces.

Follow-up 3

Can you explain the concept of a widget tree?

In Flutter, a widget tree is a hierarchical structure that represents the relationship between widgets. It is similar to the DOM tree in web development. The widget tree starts with a root widget and branches out into child widgets. Each widget can have zero or more child widgets. The parent-child relationship between widgets determines their position and layout on the screen. When a widget is updated or its state changes, Flutter automatically rebuilds the affected part of the widget tree to reflect the changes.

Live mock interview

Mock interview: Basics of Flutter

Intermediate ~5 min Your own free AI key

Your voice and your AI key never touch our servers; the key stays in this browser and is sent only to Google. Only your round scores are saved to track progress.