# Best Flutter Interview Questions

By [crypto-kingpin.eth](https://paragraph.com/@crypto-kingpin-eth) · 2022-06-11

---

as someone who loves to build flutter apps when I first encountered with some of the flutter interview questions which is supposed to test your grasp on the very basics of flutter framework, I felt a bit ignorant that I didn’t understood these things early on, so while I was going through some of the concepts of flutter I prepared a list of my favorite flutter interview questions that will help you in your job interviews and also understanding some of the core principles of dart. I answered all of these questions based on my personal experience with flutter

### 1-Why did you choose flutter over other frameworks like react native?

even though I was familiar with javascript language which is the language used for react native, I found dart language a lot **elegant** and **suitable** for **big projects**. features like types, out of the box support for streams makes dart language a more suitable language for this case. also when it comes to UI, flutter is **design-focused** which means it used a design-centric approach and it is a huge advantage that makes flutter apps beautifully designed event without trying too much.

### 2-Have you worked with rest APIs? elaborate.

even though **firebase** is a lot popular and easier to integrate in your app than custom backend, but I prefer to use custom backend cause it gives me more control on my app. I am mainly using http package to send requests to my API and wrapping the received object in dart class(model) is my usual way of working with rest APIs also I prefer to use **nodejs** and **mongodb** for building my APIs

### 2- What is the difference between futures and streams?

*   **futures** are used for values that may **become available at some point in future** and we know that after getting the value it is not going to change and it will be the same until we make another request.
    
*   **streams** are used for values that **changes overtime**. e.g. think of a chat screen that needs to be changes after each message, in this case it is best to use streams and wait for each response and react to it accordingly(show it in screen)
    

### 3- What is the difference between Flexible and Expanded widgets?

*   **Flexible** widget is used to adjust the size of the **children** in a row or column **relative** to their parents, so if the parent row gets bigger, the child **wrapped** with Flexible widget will also get bigger
    
*   **Expanded** widget is used to make children to take **full** width/height of their parents
    
    **Flexible** widget with **FlexFit.tight** will behave the same as **Expanded** widget
    

### 4- Do you prefer writing raw code or using packages?

it totally depends on the complexity of the task but generally I don’t like to use packages unless it takes a lot of time to build it from scratch. I don’t feel like full-fledged developer when I am too reliant on third-party packages.

### 5- What is the difference between main() and runApp() in flutter?

**main** function is an entry point to the app it is independent of flutter and it is **dart specific** functionality but **runApp** function is **flutter specific** and it behaves like the entry point of the **widget tree** and returns all of the widgets that is used in our app.

### 6- What are the advantages of dart language?

*   **easy to learn.** dart is a java-like language that any body who has spent time with an OOP language will have an easy time picking it up
    
*   **portable**. there is no need for you to install anything to work with dart. dart comes with **dartPad** which is a web interface that allows you to write dart programs online
    
*   **type-safety**
    

### 7- What are keys in flutter?

You don't need to use Keys most of the time, the framework handles it for you and uses them internally to **differentiate between widgets**. There are a few cases where you may need to use them though. for instance if you have a child you want to access from a parent, you can make a **GlobalKey** in the parent and pass it to the child's constructor. Then you can do **globalKey.state** to get the child's state

### 8- Explain the different types of streams?

*   **single subscription streams:** it is the most common type of streams which contains a sequence of events, which is part of a whole. it will deliver the event in the correct order and without missing any of them. if any of the events are missing then the rest of the stream makes no sense. e.g. downloading a file from web
    
*   **broadcast streams:** it is another type of steam that can deliver the events one at a time without the knowledge of previous events. e.g. mouse events in browser.
    

### 9- Explain the difference between hot reload and hot restart?

**hot reload** is a nice feature of flutter that allows developers to see the result of their changes to code in a **very short time**(even less than a second) also it **keeps the state** of the widgets so you can still access the old data in your widgets after hot reload. **hot restart** on the other hand completely **resets** **the state** and it takes longer than hot reload.

### final words

you can reach me via [twitter](https://twitter.com/christopherwd5) for any recommendation. thanks for reading

---

*Originally published on [crypto-kingpin.eth](https://paragraph.com/@crypto-kingpin-eth/best-flutter-interview-questions)*
