Flutter Interview Questions

What is Flutter?

Flutter is a UI framework which is useful in creating fast, beautiful, natively compiled mobile applications with one programming language and a single codebase. It is an open-source development framework developed by Google. Flutter is not a language; it is an SDK/Framework. Flutter use Dart programming language for internal working. Its alpha version was released in May 2017.

Flutter is optimized for 2D mobile apps that can run on both Android and iOS platforms. We can also use it to build full-featured apps, which can have camera, storage, geolocation, network, third-party SDKs, and more.

What is Dart?

Dart is C-style syntax which is used as a general-purpose, object-oriented programming language. It’s open-source and developed by Google in 2011. It’s purpose is to create a frontend user interface for the web and mobile apps. It is an important language used for creating Flutter apps. The Dart language can be compiled both AOT (Ahead-of-Time) and JIT (Just-in-Time) compiler.

Should I learn Dart for Flutter?

Yes, As Flutter is just a framework wrapping dart language.

What are the Flutter widgets?

In Flutter Everything is a widget.A Flutter app can be seen as a tree of widgets. Widgets are the UI descriptor which the user interacts with.

Widgets are nested to build an app in flutter. It means your app’s root is also a widget, and all it’s parts are also widgets.

What do you understand by the Stateful and Stateless widgets?

A Stateful widget are widget that maintains the state information. They are also referred as dynamic because we can change there inner data during there lifetime. The widgets that allows us to refresh the screen are called a Stateful widget. These widget don’t have a build() method. They have createState() method, that returns a class that extends the Flutters State Class. It’s examples are Checkbox, Radio, Slider, InkWell, Form, and TextField.

The Stateless widget are widget that does not contain any state information. They remains static throughout the widgets lifecycle. It’s examples are Text, Row, Column, Container, etc. If the screen or widget doesn’t have any dynamic element which need to be changed we should use a Stateless widget, otherwise use a Stateful widget.

What are the best editors for Flutter development?

The best Editors/IDE’s to work with flutter are:

  • Android Studio
  • Visual Studio
  • IntelliJ IDEA
  • Xcode

What is the pubspec.yaml file?

It is the configuration file that is used for adding the dependencies and assets and maintaining the project general settings of the Flutter project. It is necessary to maintain it as it help us download and use the different packages we need to make our project work.

What are packages and plugins in Flutter?

A package is a group of similar types of classes, interfaces, and sub-packages which we can import and use in our project.Packages and plugins are reusable code which we can use by adding them to the pubspec.yaml file. So packages help us in building the app without having to develop everything. It allows us to import new widgets and functionality into the app.

How can Flutter communicate with native frameworks in Objective-C/Swift/Kotlin/Java?

Through plugins. We can call any native code, we have to create a bridge between the native code and Flutter.

What’s a ‘SafeArea’ widget for?

It’s a widget that makes it easy to place other widgets in a portion of the view that’s will be unobscured by bars and other content like status bars.

Is Flutter only for mobile apps?

No, Newer versions of flutter have stated supporting desktop and web also

What are keys, and when do you use them?

A key is an identifier that can be used for widgets, elements, and semantic nodes for making them distinguished. Keys can be useful when we want to preserve a state when widgets move around in your widget tree. That means, if you use the key on a ScrollView, you can preserve the scroll position when modifying a collection.

What’s the difference between the debug and profile modes?

The debug mode is used for debugging the app. Profile mode is mainly used for checking the resource consumption as we can check how much memory or network i/o the app is using.

When do you use ‘double.infinity’?

When we want the height or width of the widget same as the parent we use double.infinity.

How do you create a widget that looks different in iOS and Android?

We can use flutter_platform_widgets plugin, which makes it easy to handle we can check manually using:

Platform.isIOS from dart:io package
if(Theme.of(context).platform == TargetPlatform.iOS)

How do you make HTTP requests in Flutter?

The easiest way to make HTTP requests is using the HTTP package (import ‘package:http/http.dart’ as http;).
It has many convenient method for making a request:
Like http.get(‘https://jsonplaceholder.typicode.com/albums/1′);
This returns a Future.

How do you use hexadecimal colors?

const Color(0xFF000000);

How to create a TextField with initial value?

We can set the text editing controller with an initial value example TextEditingController(text: “Initial Text”).

Is there any way to dismiss the keyboard programatically?


What are the ways to add a ‘ListView’ to a column?

There are many ways to add a ListView to a container lets see some:

  • Explicitly setting the height of the ListView,
  • Using the shrinkWrap property on the ListView, or
  • Wrapping the ListView with an Expanded widget.
Subscribe Now