---
title: "Preparing for and Succeeding in the Job Interview"
description: "The Flutter interview process from first call to job offer, culture fit and compensation, and answers to all 146 interview questions of the book."
canonical_url: "https://mobile-dev.peteroncode.dev/en/flutter-for-jobseekers/preparing-for-the-job-interview"
---
# Preparing for and Succeeding in the Job Interview

> The Flutter interview process from first call to job offer, culture fit and compensation, and answers to all 146 interview questions of the book.

<u-page-hero>
<template v-slot:title="">

Preparing for and Succeeding in the Job Interview

</template>

<template v-slot:description="">

Whether this is your first interview or your hundredth, it never hurts to be **prepared**.

</template>
</u-page-hero>

But how do you prepare for a Flutter interview if you have never had one? What can you expect the process to look like? What kinds of questions will you be asked? What kind of questions should *you* ask? How do you answer the question, *so, what are your compensation expectations?*

For many of us, the process can be daunting, but fear not! In this chapter, we are going to break down the entire process, start to finish, and make sure that you have got all the tools you need going into the interview to be successful — and **land that job**!

## Chapter overview

<card-group>
<card icon="i-lucide-list" title="Structure">

- The interview process, start to finish
- What to expect during a technical interview
- Culture fit interview: Evaluating a company and being evaluated
- Negotiating compensation
- Answering some interview questions
- Accepting your first Flutter job

</card>

<card icon="i-lucide-target" title="Objectives">

After completing this chapter, you will understand what a common interview process looks like when interviewing for a technical role. We will also look at the nearly 150 interview questions (plus a couple of extras!) throughout this book and answer each of them, preparing you for most questions you could be asked during a technical interview.

</card>
</card-group>

## The interview process, start to finish

Interviewing for a technical role, such as that of a Flutter developer, is quite different than interviewing for other types of non-technical jobs. Typically, the interview process will be broken down into about **four to five discrete sections**, spanning multiple days and often with several different people. This may sound daunting, but once we break it down, you will understand why this is.

<steps level="4">

#### Initial conversation

The first part of the interview process is typically a brief, initial conversation where you will speak to a non-technical person, such as somebody from the human resources team. If you are collaborating with a recruiter, this step may be omitted as this exploratory phase would have been done between you and the recruiter, as well as between the recruiter and the company. This conversation is where interest between the employer and you, as a candidate, is established. You will be asked questions like, *so, how did you hear about our company?* They will typically leave room for you to ask questions, as well.

You can expect this to be a light, casual conversation where you will talk about your educational and technical background at a high level, and you will hear more about the business, what it is they do, and where you might fit in with their team. **Have fun with this one!** Just remember to stay professional. Often, this first conversation will end with setting up a time for a first technical interview, although that may come later in some instances.

#### Technical interview

The next step of the interview process is usually the technical interview. This might be a single meeting, or it might be broken into two separate discussions with some coding done in between. We will talk more about this process in a little bit since it is going to be the **bulk of the interview process**.

#### Culture-fit conversation

After the technical interview usually comes a culture-fit conversation. By this point, the company is confident in your technical abilities and is interested in making sure that you will get along with the team. You will probably meet with several people from across the whole team that you will be working with should the offer of employment be extended. They might be interested in your hobbies and interests outside of Flutter. Primarily, what they are looking for is whether your **personality, work style, ethics, and core values** align with the company's.

This may be the most important part of the interview, as working for a company where you do not share the same values, or you work in a way that is at odds with the rest of the company would make for a miserable experience for both you and the company. That is why we are going to talk about this much more in-depth later in this chapter.

#### Job offer

The final part of the interview process is the job offer itself. This is where compensation and titles will be discussed, as well as any benefits the company may offer. Compensation is not just an hourly or salary wage, though. Depending on the role and company, it may include stock options, a 401(k) (retirement) plan, stipends for attending conferences, an allowance for purchases related to the job, or many other benefits. We will discuss this more later in the chapter, as well.

</steps>

<tip>

It can sometimes take **several days or a couple of weeks** between each of the interview steps, so if you do not hear back immediately throughout the process, try not to worry — they are coordinating schedules between a lot of very busy people and they might be interviewing other candidates as well (which means more scheduling and coordination!)

</tip>

<note>

Again, the **order of these conversations is bound to differ** from company to company, so do not be surprised if they start with the compensation conversation, then the culture-fit, and finally, the technical interview.

</note>

Now that you know what to expect broadly during the interview process, let us look more closely at the areas we called out earlier, starting with the technical interview.

## What to expect during a technical interview

The goal of a technical interview is to evaluate your **critical thinking skills** and whether you can translate your thought processes into code that is well-structured and reasonably correct. They want to know how you think and whether you can explain your thought process.

It is ok not to know the answer to every question they ask, but be careful about saying, *I do not know*. Doing so does not give the interviewer much to work with to help them get things back on track. Not knowing an answer is not a dealbreaker by any means, but not managing the stress and pressure of the interview process effectively could show them that you might not be able to do your job under pressure, either.

<caution>

If you get nervous, you might be tempted to guess at an answer. *Do not do this*. You will be nervous, which means your brain probably is not working at peak efficiency. You are bound to forget things that you know well; it happens to the best of us. The absolute worst thing you can do is **make up answers or guess at things**. Giving a blatantly wrong answer will stick with the interviewer in a way that you would rather not have them remember you for.

</caution>

<tip>

Instead, take a deep breath and count to three. Pause. Calm yourself down. Then, **ask several thoughtful questions** to have them supply clarification. Not only does this give you time to think, but it might unveil just the right information that you need to connect the dots and give a thoughtful, *correct* answer.

</tip>

In your technical interview, they are likely to ask you to complete some sort of *task*, then expect you to talk through the problem, devise a solution, and write some code to accomplish it. There are several different ways by which this can be accomplished:

<card-group>
<card icon="i-lucide-presentation" title="Whiteboarding">

Asking you to whiteboard the code (that is, to write the code on a whiteboard — sometimes literally, if you are interviewing in person). If you are whiteboarding the issue, **think aloud**. Remember, they are there to evaluate your thought process and critical thinking skills. Do not let them guess what you are thinking.

</card>

<card icon="i-lucide-monitor" title="Online coding challenge">

Completing an online coding challenge, such as by asking you to complete a challenge on HackerRank.

</card>

<card icon="i-lucide-house" title="Take-home exercise">

Allowing you to complete the coding exercise in your own time before the interview. In that case, you would be asked to submit the code several days prior to the interview so that they could look it over before talking to you. It is common for them to ask you to **change the code during the live portion** of the call if you have completed the coding exercise beforehand.

</card>
</card-group>

Usually, the technical interview will involve **two or more people** from the company you are interviewing with. You should expect the hiring manager and a senior member of the team. They will be evaluating you for more than your technical abilities and critical thinking skills, so be personable and feel free to engage in the non-technical banter at the beginning of the interview process.

<tip>

This banter is designed to both put you at ease before asking you to delve into your technical ability, as well as to get to know you as a person. This is a wonderful time to talk about non-work-related things that you enjoy, such as sports, travel, cooking, or your favorite book.

</tip>

## The culture fit interview: evaluating a company and being evaluated

The interview process is more than just a company evaluating *you*. It is also about you getting to know *them*. As we discussed before, the usual next step after a technical interview is a culture-fit conversation. This might be the most important part of the interview, because if you and your potential employer and/or new team do not work well together, things simply will not work out, and you will be back to looking for a new job in no time.

<warning>

It is easy to write this part of the interview off, especially when you are out of work, but give it the time and attention it deserves. **Your mental health is not worth the paycheck.**

</warning>

So, how do you prepare for a culture-fit interview? It starts by understanding what is important to *you*. Take some time to sit and write down the answers to these questions:

- *What sort of environment do I need to do my best work?* (Is it a quiet, dimly lit environment? A cubicle where coworkers can pop in to ask a question at any time? Fully remote, so you can wear pajamas all day?)
- *What sort of company do I want to work for?* (Do you feel comfortable working for a company that contributes to accelerated climate change? Is it important for the company to contribute to the community, by offering volunteer opportunities, contributing to open-source projects, or offering public workshops?)
- *How many meetings are too many meetings?* (Some companies have a *lot* of meetings — how many is too much for you? Do you prefer a structured environment where policy and procedure are all spelled out, or a fast and loose culture, where things are figured out on the fly?)
- *What sort of accommodations are important to me?* (Does the company need to be ADHD-friendly? LGBTQIA-friendly? Wheelchair accessible?)
- *How important is it for an employer to offer me a path to grow?* (Are you content being hired somewhere where you are never mentored or given the opportunity to expand your skillset? What about being offered a way to transition to a different type of role, such as management?)
- *What does my ideal boss look like?* (What qualities might they have? Are they hands-on or laid back?)
- *How do I prefer to get feedback?* (Do you prefer informal meetings or performance reviews?)
- *Do I prefer to work alone or as part of a team?* (If you prefer working on a team, what size team?)
- *How do I handle stress?* (Are you cool and calm under pressure, or do you totally break down? How might this affect how you interact with a team? What sorts of questions might you need to ask?)
- *How important is work-life balance to me?* (Some people are built to work *all the time*. Others have families and enjoy taking their evenings and weekends to spend time with friends or doing hobbies.)
- *What motivates me?* (Are you motivated by solving complex problems? Receiving a reward, such as praise? Do you enjoy teaching or learning?)
- *What is my ideal work schedule?* (Do you work best in the mornings? At night? Certain days during the week? Do you prefer to work all year and take a few weeks off during the summer for a long vacation?)
- *What is my long-term plan?* (As cliché as it sounds, think about what your 5-year and 10-year plans are. Where do you envision yourself?)

Hopefully, by answering these questions, you will spark further inspiration to ask yourself even more questions. Knowing yourself well enough to know what it is you want, need, and what your goals are will help you evaluate a company to figure out if you would be a good fit there.

<card-group>
<card icon="i-lucide-puzzle" title="Culture fit">

When a company looks for a fit to its existing culture, it could unintentionally lead to **discrimination** against candidates who do not think, act, or look like existing employees.

</card>

<card icon="i-lucide-sparkles" title="Culture add">

When the time comes to have a culture-fit conversation, you may wish to speak about a culture *add* rather than a culture *fit*. In this context, it could be useful to talk about your ability to bring **fresh, innovative ideas** to the team. Culture *add* strengthens the company by adding new perspectives into the mix.

</card>
</card-group>

<tip>

Prior to this part of the interview, it will be worth your time to **research the company**:

- Explore the company's social media and any news about them.
- Visit their website: many companies have a section on the website about their mission.
- Check sites such as Glassdoor to see what employees are saying about working there.
- Reach out to current and past employees to ask for their perspectives.

Anything you can do to understand the company and whether it shares your values, ethics, and vision will help prepare you for this part of the interview.

</tip>

## Negotiating compensation

If both you and the employer walk away from the culture fit portion of the interview feeling confident, the next step is likely receiving a job offer. What sort of compensation you are offered will vary widely based on things such as geographic location, size of the company, whether the company is a startup or publicly traded, whether you are a contractor or full-time employee, and your own experience.

You will either be offered an **hourly or salary wage**, and anything after that will vary. In some countries, with some employers, depending on the role, you may be offered:

- a retirement plan
- private health insurance
- stock options
- a wellness budget to join a gym
- a conference allowance to travel to a relevant technology conference once a year
- a technology budget for things like a laptop, an external display, a mouse/keyboard, or sometimes even a desk and chair

You will have to figure out what part of a compensation package is **most important to you**. Are you being offered private health insurance but are covered by your spouse? You may be able to negotiate a higher salary instead. Perhaps you are interested in receiving more shares in the company. You could trade some of your salary for those additional shares.

When it comes to the wage, you will have to do your own research to understand the current **market rates** for a developer with your skillset in the position you are applying for. Sites like Glassdoor may list wages for other employees at the company in your role or an adjacent one. Try not to price yourself too high or too low. If you have been collaborating with a recruiter, you should be having these sorts of compensation conversations, and they will be able to help you navigate the process.

<warning>

Negotiating your compensation might be the scariest part of interviewing with a company, but it is also extremely important. The wage you start at **may follow you for years** while you work at the company and could influence your sense of worth the next time you seek a position elsewhere. Take the time now to understand the market, the value you bring, and what the company is offering (as well as what they might be flexible on).

</warning>

<tip>

**Do not accept the offer on-the-spot**, but give yourself time to think about it, discuss it with your recruiter, and really evaluate whether it is right for you.

</tip>

## Answering some interview questions

Let us seek to answer some interview questions you will likely have to prepare for, starting with all the questions in this book.

<accordion>
<accordion-item icon="i-lucide-circle-help" label="1. What design paradigm does Flutter use?">

Flutter uses an **aggressive composability** design paradigm. Widgets are built up using smaller and smaller widgets, down to the most basic widgets. Learn more about this by reviewing [Chapter 4: Introduction to Widgets](https://mobile-dev.peteroncode.dev/en/flutter-for-jobseekers/introduction-to-widgets), and by reading the documentation found on Flutter docs website; [https://docs.flutter.dev/resources/inside-flutter#aggressive-composability](https://docs.flutter.dev/resources/inside-flutter#aggressive-composability).

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="2. What method is called for each widget when Flutter wants to draw a widget to the screen?">

The `build()` method is run each time Flutter needs to draw a widget to the screen. The `build()` method will always return a widget, which is generally composed of other widgets. The resulting widget will be added to the widget, element, and render trees.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="3. What are three ways you can figure out what properties are available for a widget?">

There are several ways to figure out what properties are available for any given widget:

- The quickest and easiest way is to simply **hover your mouse cursor** over the widget in question. By doing so, the widget's documentation will appear, outlining the available properties, as well as some other documentation.
- You can also refer to the **documentation online** by searching [https://flutter.dev](https://flutter.dev) for the widget name.
- The third way is to **go to the widget's definition** by holding *Ctrl*/*⌘* and clicking on it. Once there, you will be able to explore not only the properties available, but how they are used within the widget, as well.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="4. What is the difference between a positional parameter and a named parameter?">

When passing parameters to a widget, if the widget has positional parameters, the order matters. If you have a widget that takes two positional parameters, one being a `String` and the other a `bool`, passing the `bool` before the `String` will cause the widget to fail to build. However, if those parameters are converted to named parameters, the order no longer matters.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="5. When creating a widget, how do you specify that a parameter is either positional or named?">

Named parameters are wrapped in curly braces `{}`. Positional parameters are not. In the following example, the parameter `text` is a positional parameter, whereas `isActive` is a named parameter. The value passed into either a positional or named parameter is called an **argument**.

```dart
class Test extends StatelessWidget {
  final String? text;
  final bool? isActive;
  const Test(this.text, {this.isActive, super.key});

  @override
  Widget build(BuildContext context) {
    return Text('$text $isActive');
  }
}
```

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="6. What does the question mark after a type confer?">

The question mark tells Dart that the type is **nullable**. A `String?` can either be a `String` or `null`. However, a `String` can never be `null`.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="7. When would you need to use a Key?">

A `Key` is used by the framework to match a widget with other widgets when a rebuild is triggered. It can be useful to set a `Key` when you need to preserve a widget's state as it moves around the widget tree. In practice, it is rare to manually specify a `Key`; however, it can be a useful tool, especially when writing tests, as it will enable you to find a widget more easily in the widget tree programmatically.

If you find yourself modifying a collection of widgets of the same type that hold some sort of state, it is time to add a `Key`. (Think: reordering a to-do list, where the state holds a checkbox.) There are several types of keys, such as `LocalKey`, `GlobalKey`, and `UniqueKey`. Learn more about `Key`s from the official Flutter documentation, which you can find here: [https://api.flutter.dev/flutter/foundation/Key-class.html](https://api.flutter.dev/flutter/foundation/Key-class.html).

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="8. What is a private object and how is one defined?">

A private object is something that cannot be used outside of the local library where it has been defined. When defining a private object, simply **prepend an underscore** to the name or type you are defining. The underscore conveys that the variable or method is scoped locally to the library in which it can be found. A library can be a single file or multiple files connected with the `part` and `part of` keywords.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="9. What is the lifecycle of a stateful widget?">

1. `createState()`
2. `mounted == true`
3. `initState()`
4. `didChangeDependencies()`
5. `build()`
6. `didUpdateWidget()`
7. `setState()`
8. `deactivate()`
9. `dispose()`
10. `mounted == false`

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="10. What is the difference between a stateless and stateful widget?">

A **stateless widget** would not update once the widget is added to the widget tree. If the properties which were used to create it change by way of a parent widget passing down new properties, the widget will be discarded, the associated element in the element tree will be updated, and a new widget will be created before being inserted into the widget tree in place of the previously discarded widget.

In contrast, a **stateful widget** can maintain its own state and allows for the mutation of its properties. A stateful widget will rebuild whenever the state is changed and `setState()` is called.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="11. What is the purpose of an inherited widget? What is an example of one?">

Inherited widgets are accessible via `BuildContext` and allow you to access their properties from any widget, which is an ancestor in the widget tree. Common inherited widgets you will find are `MediaQuery`, `Theme`, and `Navigator`.

<note>

**Corrected:** as in [Chapter 4](https://mobile-dev.peteroncode.dev/en/flutter-for-jobseekers/introduction-to-widgets), the widgets that read an inherited widget are its **descendants**, not its ancestors: the `context` that looks it up "must be a descendant of the InheritedWidget" (Flutter, n.d.-a). Of the three examples, only `MediaQuery` is one (it extends `InheritedModel`, a kind of `InheritedWidget`). `Theme` is a `StatelessWidget` that builds a private inherited widget, `_InheritedTheme`, which `Theme.of` reads. `Navigator` is a `StatefulWidget`, and `Navigator.of` finds its `NavigatorState` with `context.findAncestorStateOfType<NavigatorState>()`, not through an inherited widget (flutter/flutter, n.d.).

</note>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="12. What is BuildContext?">

`BuildContext` contains information about where a widget is in the widget tree. When a widget is rendered, it is part of the widget tree and has a corresponding `RenderObject` in the element tree. `RenderObject`s are an implementation of `Element`, which implements `BuildContext`.

<note>

**Corrected:** it is the **element** that implements `BuildContext` (`abstract class Element extends DiagnosticableTree implements BuildContext`), and every widget in the tree has one in the element tree. A `RenderObject` is not an `Element`: it is a node of the separate render tree, and only the elements of render object widgets (`RenderObjectElement`) create and hold one (flutter/flutter, n.d.).

</note>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="13. What is the difference between Material and Cupertino-styled widgets, and when would you use one over the other?">

**Material** widgets are styled after Google's Material Design system. You can read more about Material Design's philosophies here: [https://m3.material.io/](https://m3.material.io/). **Cupertino** (named after the city in which Apple is headquartered) looks to implement Apple's Human Interface design system. You can read more about Apple's Human Interface Guidelines here: [https://developer.apple.com/design/](https://developer.apple.com/design/).

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="14. What is a callback function?">

A callback function is a function that is passed into another function or method (including the `build` method of a widget) as an argument to a parameter, which will be called from inside that function, but will run in the scope of the parent widget. For example, a button will have an `onPressed` callback function. When the button is pressed, the `onPressed` callback function will run.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="15. What is the best way to add an icon to an OutlinedButton?">

To add an icon to the `OutlinedButton`, use the `OutlinedButton.icon` constructor rather than by supplying the icon as a child of the button.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="16. How do you style a button, including changing its color?">

To style a button, you should either add a style to the button itself or add your style to the `Theme`. Button style parameters expect a `MaterialStateProperty` object, which will resolve the various states of a button (neutral, pressed, disabled, and so on) into a style. Refer to the documentation on the Flutter website for more information. You can find that here: [https://api.flutter.dev/flutter/material/ButtonThemeData-class.html](https://api.flutter.dev/flutter/material/ButtonThemeData-class.html).

<note>

**Corrected:** `MaterialStateProperty` is deprecated: "Use WidgetStateProperty instead. Moved to the Widgets layer to make code available outside of Material. This feature was deprecated after v3.19.0-0.3.pre." The linked `ButtonThemeData` themes the legacy buttons and "is planned to be deprecated in a future release"; the `TextButton`, `ElevatedButton` and `OutlinedButton` families are themed with `TextButtonThemeData`, `ElevatedButtonThemeData` and `OutlinedButtonThemeData` instead (flutter/flutter, n.d.).

</note>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="17. How do you disable a button?">

Disabling a button is as simple as ensuring the `onPressed` method is `null`. This is typically done by checking some sort of state or variable, then returning a method when the appropriate conditions are met.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="18. What widget can you use to convert an arbitrary widget, such as a Container, into a button?">

`GestureDetector` not only allows you to turn a `Container` into a button but allows you to perform all sorts of swipe, tap, drag, pinch, and other gestures.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="19. What widget can be used to detect a swipe gesture?">

If you guessed `GestureDetector`, you would be right! There are other widgets that implement this functionality, too, such as `Dismissible`.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="20. How do you change the type of keyboard presented to a user on a mobile device when they tap a text field? For example, how would you present the user with a keyboard which is more appropriate for numerical input?">

Text inputs generally have a `keyboardType` property, which takes in a `TextInputType` object. To display a keyboard tailored for numerical input, use `keyboardType: TextInputType.number`.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="21. What is a TextEditingController used for?">

This allows you to access text which has been entered into a text input from outside the widget. It will also allow you to save, recall, and reset the contents of the field.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="22. In what order are input formatters applied?">

Input formatters are applied top to bottom, in the order defined in the `List<TextInputFormatter>` of your text input's `inputFormatters` property.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="23. How can you prevent users from typing numbers in a text field, and instead only allowing letters?">

Use a `FilteringTextInputFormatter` to only allow the characters you want, using a `RegExp`.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="24. You have a DateTime object with a given date. How do you figure out what the date will be precisely one year in the future from that date?">

`DateTime` objects can be added to or subtracted from using the `add` and `subtract` methods, which take a `Duration` object. The current date/time can be generated using the `now` constructor. `DateTime.now().add(const Duration(days: 365))` would result in a `DateTime` object with a time precisely one year in the future.

<note>

**Corrected:** as in [Chapter 5](https://mobile-dev.peteroncode.dev/en/flutter-for-jobseekers/handling-user-input), 365 days is precisely one year only when no 29 February falls in between; across a leap day it lands one calendar day off. For the same date one year later, build the date from its parts: with `final now = DateTime.now();`, use `DateTime(now.year + 1, now.month, now.day)`.

</note>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="25. What is a key difference between the material date picker and the Cupertino date picker?">

The Material date picker is much simpler to implement, requiring minimal setup work, whereas the Cupertino date picker needs to be placed within a modal popup to position it appropriately on the screen. The Material date picker can quickly switch between time and date options, while the Cupertino date picker needs to be told what mode to operate in.

Finally, the Cupertino date picker can be used to select more than just a date/time. It is also capable of displaying arbitrary lists of data to pick from, such as choosing a day of the week, or a duration for a timer.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="26. What does the map method of a List do?">

This will allow you to perform an action on every object within the list, returning an iterable object, which can then be mapped back into a `List` if so desired. See [Chapter 5: Handling User Input](https://mobile-dev.peteroncode.dev/en/flutter-for-jobseekers/handling-user-input) for an example.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="27. What are some considerations when you want to use a group of Radio buttons?">

Consider whether the look and feel are appropriate for the platform your application is running on. A Cupertino-styled radio button would feel out of place on an Android device, for example. Also, consider if there is a more appropriate widget: if your radio buttons toggle between two options, could you use a switch instead?

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="28. How many states does a Checkbox have?">

The available states are `true` and `false`. However, if `tristate: true` is set, a third option of `null` becomes available. A checkbox will become disabled if the `onChanged` argument is `null`.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="29. How can you limit the minimum and maximum values of a Slider?">

By specifying the `min` and `max` properties.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="30. What is a Form and what is the benefit of using one? What are some cases in which a Form might not be necessary?">

A `Form` groups together several input widgets, allowing you to specify a `Key` to save, recall, reset, and validate all the inputs at once. If you only have one input, a `Form` is not necessary.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="31. What is the difference between a TextField and a TextFormField?">

A `TextFormField` is a `TextField` that is wrapped in a `FormField`, which allows you to use the `onSaved` and `validator` methods.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="32. How do you validate an input?">

Use a `validator` function on any widget with a `FormField`.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="33. What is a regular expression?">

Regular expressions are patterns used to match character combinations in strings of text.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="34. What is pubspec.yaml used for?">

This file contains basic information about your Flutter or Dart project, including the package name, description, and whether to publish it to pub.dev. It also defines what versions of Dart and Flutter to use, what packages are used by the project, and what external assets to include.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="35. What language is pubspec.yaml written in?">

The `pubspec.yaml` file is written in the YAML markup language.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="36. What are the required directives for Flutter in pubspec.yaml, and what do they do?">

- `name`: Used to name the package.
- `version`: Used to define what the application's version number is.
- `environment`: Used to define which version of Flutter/Dart the project relies upon.

Other directives include `description`, `publish_to`, `dependencies`, and `dev_dependencies`. Both `dependencies` and `dev_dependencies` are required for Flutter projects. They define what packages are used within the project and which versions of those packages to use.

<note>

**Corrected:** the pubspec reference lists `name` as "Required for every package" and `environment` as "Required as of Dart 2"; `version` and `description` are only "Required for packages that are hosted on the pub.dev site". `dependencies` "Can be omitted if your package has no dependencies", and `dev_dependencies` "Can be omitted if your package has no dev dependencies" (Dart, n.d.-a). A Flutter project still lists `flutter: sdk: flutter` under `dependencies` in practice, as the projects created by `flutter create` do.

</note>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="37. How do you update the package versions in pubspec.yaml with a single command?">

Use `dart pub upgrade --major-versions` to upgrade your packages to the latest resolvable versions.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="38. How do you add images, fonts, sounds, or other assets to your application?">

Include them in the `assets` directive within the `flutter` directive.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="39. What is Pub?">

Pub is the package management ecosystem for Flutter and Dart. The website, pub.dev, is used to browse the available packages, whereas the command line tool(s) provided by Dart and Flutter are used to manage adding, removing, and upgrading the packages used by your project.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="40. How does dependency version pinning work?">

Dependencies can be pinned to a specific version by omitting the caret (^) in front of the version number. If the caret is present, the package can be upgraded to newer versions that fall within the dependency constraints. For example, a version of `^2.1.0` could be upgraded automatically to any version, provided it was still in the 2.1.x version range, such as 2.1.9. Learn more about package versioning here: [https://dart.dev/tools/pub/versioning](https://dart.dev/tools/pub/versioning).

<note>

**Corrected:** as in [Chapter 6](https://mobile-dev.peteroncode.dev/en/flutter-for-jobseekers/using-packages-and-assets), the caret range stops only *before* the next major version: "`^version` means *the range of all versions guaranteed to be backwards compatible with the given version*" (Dart, n.d.-b). So `^2.1.0` means `>=2.1.0 <3.0.0`, and 2.9.0 is allowed as well as 2.1.9.

</note>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="41. Where can one browse a list of packages that are available to add to a Flutter or Dart project?">

Head on over to [https://pub.dev](https://pub.dev)!

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="42. What are Pub Points, and how are they calculated?">

Pub Points are a measurement of the quality of a package based on numerous criteria. These criteria are ever-evolving, but as of writing they are as follows:

- Follow Dart file conventions (30 points total)

  - Provide a valid `pubspec.yaml` (10 points)
  - Provide a valid `README.md` (5 points)
  - Provide a valid `CHANGELOG.md` (5 points)
  - Use an OSI-approved license (10 points)
- Provide documentation (20 points)

  - Provide an example usage of the package (10 points)
  - 20% or more of the public API has `dartdoc` comments (10 points)
- Provide support for all 6 platforms (20 points)
- Pass static analysis (code has no errors, warnings, lints, or formatting issues) (30 points)
- Support up-to-date dependencies (20 points)
- Dart 3 and Flutter 3.10 compatibility (20 points)

The total number of points a package can have, as of writing, is 130. Find out more about how Pub Points are calculated here: [https://pub.dev/help/scoring#pub-points](https://pub.dev/help/scoring#pub-points).

<note>

**Corrected:** as in [Chapter 6](https://mobile-dev.peteroncode.dev/en/flutter-for-jobseekers/using-packages-and-assets), pub.dev's scoring help no longer publishes a total or a point value per check. It says "Pub points are awarded in six categories", lists the checks under *Follow Dart file conventions*, *Provide documentation*, *Platform support* (including *Support modern toolchains* such as Swift Package Manager and Wasm), *Pass static analysis*, and *Support up-to-date dependencies* (the latest stable Dart SDK, Flutter SDK and dependencies), and has no separate Dart 3 / Flutter 3.10 check (pub.dev, n.d.-a).

</note>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="43. How can one save a list of their favorite packages on Pub?">

First, create an account and log in. Then, find a package you would like to save. Navigate to the package details and look for the thumbs up icon near the top. To find the list of packages you have saved, hover over **My pub.dev** in the header, then choose **Likes** from the list.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="44. How can you play audio in your Flutter application?">

Use a package such as `just_audio`.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="45. Where can you find a list of popular Flutter and Dart packages?">

The home screen of `pub.dev` includes a list of the most popular packages and the top packages on Pub.

<note>

**Corrected:** (checked on 2026-11-16) the pub.dev home page no longer has a "most popular" list. Its sections are **Flutter Favorites**, **Trending packages** ("Top trending packages in the last 30 days"), **Top Flutter packages**, **Top Dart packages** and **Package of the Week** (pub.dev, n.d.-c).

</note>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="46. What are some ways in which data can be persisted across app launches?">

Use a package such as `shared_preferences`, `encrypted_shared_preferences`, or `isar` to store data on the device's local storage. Then, read that data the next time the app launches.

<note>

**Corrected:** as in [Chapter 6](https://mobile-dev.peteroncode.dev/en/flutter-for-jobseekers/using-packages-and-assets), check `isar`'s maintenance before depending on it. When this page was written (November 2026), its latest stable version on pub.dev, 3.1.0+1, had been published three years earlier, with only `4.0.0-dev` prereleases after it (pub.dev, n.d.-b).

</note>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="47. What YouTube playlist does the Flutter team use to showcase popular packages?">

The **Flutter Package of the Week** playlist, which is available on YouTube here: [https://www.youtube.com/playlist?list=PLjxrf2q8roU1quF6ny8oFHJ2gBdrYN_AK](https://www.youtube.com/playlist?list=PLjxrf2q8roU1quF6ny8oFHJ2gBdrYN_AK)

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="48. What is a Future?">

Any event which does not happen instantly will return as a `Future`. A future is a promise that, once the work has been completed, a value will be returned.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="49. What is the difference between synchronous code and asynchronous code?">

Synchronous code is *blocking*, whereas asynchronous code is *non-blocking*. Blocking code prevents the execution of other steps from taking place, whereas non-blocking code allows processing to continue while the non-blocking code is run in the background.

<note>

**Corrected:** as in [Chapter 7](https://mobile-dev.peteroncode.dev/en/flutter-for-jobseekers/working-with-apis-and-async), asynchronous Dart code does not run in a separate background thread. An isolate has "a single thread running an event loop"; `Future` and `Stream` code takes turns on that one thread, and only separate isolates "enable parallel code execution on multiple processor cores" (Dart, n.d.-c). While an asynchronous operation waits, for example on file I/O, other code runs.

</note>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="50. What happens to the application when there is a long-lived, synchronous task being executed?">

The UI will **freeze and become unresponsive**. Avoid this by introducing non-blocking code where the blocking code currently exists.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="51. What are the async and await keywords used for?">

`async` is used to mark a method as a long-running, non-blocking process. The `await` keyword is used to wait for an `async` function to complete and return its value.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="52. What type of value does an asynchronous operation return?">

Asynchronous operations have a return type of `Future<T>`.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="53. What is an API?">

API stands for **Application Programming Interface**. It is a way in which computer programs can interact with each other without needing to know anything about how the other works. Many APIs are Web-based, using Representational State Transfer (REST) as the interface, which usually returns a JSON response, although other methods are available, such as GraphQL.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="54. What package(s) can be used to communicate with an API?">

There are many packages that can be used. The standard `http` package is a fine choice. If you need additional options which the `http` package does not offer, Dio is an excellent alternative.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="55. What sort of data is generally returned from an API?">

When working with a REST API, the most common type of data returned is JSON. However, there are other, less common types of data that could be returned from an API, such as XML. XML responses have fallen out of favor over the years, however.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="56. What is an HTTP status code, and what are some common ones?">

HTTP status codes are metadata returned from the remote endpoint to convey information about how a request was (or was not) completed.

- Status codes in the **100** range are informational messages,
- codes in the **200** range are success messages,
- codes in the **300** range are redirection messages,
- codes in the **400** range are client error messages,
- and codes in the **500** range are server error messages.

Read about HTTP status messages here: [https://developer.mozilla.org/en-US/docs/Web/HTTP/Status](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status).

<note>

**Corrected:** (checked on 2026-11-16) that link now redirects to [https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status).

</note>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="57. What is a guard clause?">

A guard clause is used in conjunction with an `if` statement to catch errors early and halt processing as soon as one is found, rather than wasting time on further processing of data that is known to be invalid.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="58. What is JSON, and what are some considerations that are important to consider when working with JSON data?">

JSON, or **JavaScript Object Notation**, is a key-value-based representation of data. In Dart, it is either a `Map<String, dynamic>` or a `List<dynamic>`, depending on the JSON's structure.

When using `print` or `log` to dump an API response to the console, any value which is a `String` will be stripped of its enclosing quotes. This can make it difficult to use these tools to analyze API responses. For this reason, prefer using DevTools to inspect responses.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="59. When communicating with an API using an HTTP client, a “verb” is used to determine which kind of action the client should take. The verbs POST and GET are used for which types of operations? Extra credit: What about PUT, PATCH, and DELETE?">

- `POST`: Used to send data to an API. Sending multiple `POST` requests would result in the server processing each request individually. (Think: making multiple orders at a restaurant.)
- `GET`: Used to retrieve data from the server.
- `PUT`: Nearly the same as the `POST` method, except that it is idempotent. Sending multiple `PUT` requests will have the same effect.
- `PATCH`: Used to modify an existing resource on the server. The resource must have been previously created with a `POST` or `PUT` before it can be modified with a `PATCH`.
- `DELETE`: Asks the server to remove a resource.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="60. When sending a POST request to an API, which properties are required to be passed into the request?">

Headers containing the content type being sent to the API must be specified. Additionally, a JSON-encoded body is often required by many APIs.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="61. What does CRUD mean?">

CRUD stands for **Create, Read, Update, and Delete**. These are the four methods available for objects in an API.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="62. What HTTP verbs relate to which CRUD operations?">

- C — `POST` or `PUT`
- R — `GET`
- U — `PATCH`
- D — `DELETE`

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="63. How can you generate List<int> containing all the odd numbers from 27 to 99?">

Use `List<int>.generate` to generate the list. Then, check each value to verify it is odd:

`List<int>.generate(37, (i) => 2 * i + 27).where((i) => i.isOdd).toList();`

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="64. How can you tell if a FutureBuilder has completed its future?">

The `builder` has an `AsyncSnapshot` value which will have a `connectionState` property equal to `ConnectionState.done`.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="65. Why would somebody choose to use a ListView over a Column? Why would somebody choose to use a Column over a ListView?">

If your list of widgets needs to be scrollable, prefer a `ListView` for performance reasons. If you are stacking a small number of related widgets which do not need to be independently scrollable, opt for a `Column`.

<tip>

Bonus: if `ListView` cannot return the different widgets you need to display, investigate Flutter's many `Sliver` widgets.

</tip>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="66. How do you display a dialog to a user?">

Flutter offers a `showDialog` method where you can use the `builder` to display a `Dialog` object.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="67. Given a dialog with two options, yes and no, how do you return either true or false from the dialog?">

When popping the `Dialog`, pass the value back like this: `Navigator.pop(context, value);` where `value` is equal to a Boolean value that references your chosen option.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="68. What is a sink? What is a stream?">

A **Stream** is an object that provides a sequence of events that can be listened to, whereas a **Sink** is an object that allows you to push data into a stream.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="69. What are the async* and yield operators used for?">

These are the sink/stream versions of `async`/`await`. The `async*` keyword means the function will `yield` multiple values as a stream of events. This is called an **async generator**.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="70. What is the async* equivalent to a FutureBuilder?">

`StreamBuilder` is the `async*` equivalent to `async`'s `FutureBuilder`.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="71. What library provides widgets which are used with sinks and streams?">

The `dart:async` library provides widgets that work with sinks and streams.

<note>

**Corrected:** `dart:async` contains no widgets. It provides the classes `Future`, `Stream` and `StreamController` (as [Chapter 7](https://mobile-dev.peteroncode.dev/en/flutter-for-jobseekers/working-with-apis-and-async) notes, `StreamController` is "A controller with the stream it controls", not a widget (Dart, n.d.-d)). The widgets that work with them, `StreamBuilder` and `FutureBuilder`, come from Flutter's widgets library (`package:flutter/widgets.dart`) (flutter/flutter, n.d.).

</note>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="72. How do you add an event to a sink?">

First, assign a `StreamController` to a variable. Then, use the `.sink.add` method on the variable.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="73. The concept of sending a user from one screen to another is known as what?">

The concept of sending a user from one screen to another is called **routing**.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="74. What is the difference between navigation and routing?">

Routing is the concept of sending a user from one screen to another, whereas navigation is the action taken to accomplish this in the code.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="75. When navigating between screens in Flutter, what analogy is useful in visualizing how different screens and their states are maintained?">

You can think of navigating as a **stack of cards**. Each card can have its own state, and new cards can be added on top of the stack, or a card on the top of the stack can be replaced by a different card.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="76. What is the difference between imperative and declarative routing?">

**Imperative** routing has step-by-step instructions for how to route from one location to another. **Declarative** routing is a method of declaring intent on where you would like to be routed to.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="77. What widget is used to route imperatively in Flutter? What widget is used to route declaratively?">

Imperative routing is accomplished using the `Navigator` widget, whereas `Router` is used for declarative routing.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="78. What are some of the limitations of Navigator 1.0?">

`Navigator` is a much simpler method of routing than `Router`, making many of the more complex tasks that `Router` provides much more difficult to accomplish. While *technically* capable of doing anything `Router` can, as `Router` is built using `Navigator`, many tasks, such as nested routing and deep linking, are better suited for a more complex routing system.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="79. How do you configure named routes, then navigate to a route by name?">

Your named routes can be set in the `routes` property of your `MaterialApp`, and then you can switch from `Navigator.push` to `Navigator.pushNamed`.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="80. What is the difference between Navigator.push and Navigator.pushReplacement?">

`Navigator.push` will add the new route to the top of the routing stack. `Navigator.pushReplacement` will replace the current route with the new one.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="81. What happens if you use Navigator.pushReplacement followed by Navigator.pop on the new screen?">

It depends on what the previous route is prior to pushing the replacement route. If the initial route is replaced by a new route, then popped off the stack, this might cause the application to exit. However, if there was a previous route on the stack before pushing a replacement route, that previous route will become the eventual route you end up on.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="82. How do you pass data to a new route? How do you get a value back when calling Navigator.pop?">

You could either pass arguments into the screen itself or you could extract the arguments using the `onGenerateRoute` method. Getting data back from a route can be done by `await`ing the navigated route and passing a value back from the `pop` method.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="83. What useful things can you use onGenerateRoute for?">

Since this method is run whenever you perform a page route, you can use it for passing arguments into a route or running any arbitrary code whenever a route happens. This makes it a prime place to introduce **analytics** into the application to understand how users are routing around the application.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="84. What widget can be used to animate a widget from one screen to another?">

The `Hero` widget can be used to animate a widget from one screen to another.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="85. What is the correct name for Navigator 2.0?">

When the **Router API** was first announced, it was referred to as Navigator 2.0.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="86. How are the ValueChanged widget and notifyListeners() method used?">

The `ValueChanged` widget will trigger a rebuild of the widget when a value is changed, then the `notifyListeners()` method is called. This is useful when you want to trigger a widget rebuild from another widget within your application.

<note>

**Corrected:** as in [Chapter 8](https://mobile-dev.peteroncode.dev/en/flutter-for-jobseekers/navigation-and-routing), `ValueChanged` is not a widget. It is a typedef for a callback, `typedef ValueChanged<T> = void Function(T value)`, a "Signature for callbacks that report that an underlying value has changed" (Flutter, n.d.-b). It triggers no rebuild by itself; in the Router API app, the rebuild comes from the `RouterDelegate`, whose callback calls `notifyListeners()`.

</note>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="87. What is a RouterDelegate?">

A `RouterDelegate` is used with the Router API to define the behavior of how the `Router` learns about and responds to changes in the routing state.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="88. How do you change the transition animation when navigating to a new route using the Router API?">

You can override the `createRoute` method of a `Page` to return a `PageRouteBuilder` with the new animation being defined within the `pageBuilder` property.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="89. What is ephemeral state, and how is it different from app state?">

**Ephemeral state** is the state of values within a stateful widget that are not managed anywhere outside of the widget. **App state** is managed by some sort of state provider which widgets can consume and respond to.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="90. Why is a stateful widget not a good option for managing app state?">

When the state of a stateful widget changes, it will trigger a rebuild of itself, which could cause issues lower in the widget tree. There is also no easy way to pass state between widgets, mutate the state from lower in the widget tree, or keep the code clean.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="91. If you have nested ListView widgets, how can you prevent the inner ListView from scrolling independently of its parent?">

To prevent a `ListView` from scrolling, pass both the `shrinkWrap: true` and `physics: const ClampingScrollPhysics()` parameters to it. Note that this will effectively turn your `ListView` into a `Column`, thereby eliminating any performance improvements gained by using a `ListView`.

<note>

**Corrected:** `ClampingScrollPhysics` does not stop scrolling. It is the "Scroll physics for environments that prevent the scroll offset from reaching beyond the bounds of the content", typical of Android. The physics that stops it is `NeverScrollableScrollPhysics`, "Scroll physics that does not allow the user to scroll" (flutter/flutter, n.d.): `physics: const NeverScrollableScrollPhysics()`, as the runnable copy of [Chapter 11](https://mobile-dev.peteroncode.dev/en/flutter-for-jobseekers/debugging-troubleshooting-performance) uses to hand the drag to the parent.

</note>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="92. What is the => operator used for? What are the benefits/drawbacks from using it?">

This is shorthand for *return this value*. It can make some code much more concise, such as when you are not processing a variable to decide what to return. However, if your method could return multiple values based on differing criteria, this operator could make it difficult to both read and write the code.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="93. What is escaping? What characters might need to be escaped?">

Escaping is a process by which special characters that would normally function as control characters in a `String` can be represented as part of that `String`. For example, a `String` with a dollar sign in it would normally cause Dart to evaluate the next word as a variable name, replacing both the dollar sign and word with the value of the variable. If you would rather have the dollar sign as part of your `String`, you would prepend the dollar sign with a backslash (`\`).

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="94. What is interpolation?">

Interpolation is used to evaluate complex variables or methods directly inside a `String`. It is often used to evaluate a single property of an object, such as with `"Hello, ${user.name.first}!"` or by directly invoking a method call, like this: `"Hello, ${getUsersFirstName(user)}!"`. It can also be used to escape a quote that would otherwise break the String definition, such as this: `'That\x27s great news!'`.

<note>

**Corrected:** `\x27` is not interpolation but an **escape sequence** (Question 93): `\x` followed by two hexadecimal digits stands for that character code, here `'`. `'That\'s great news!'` escapes the quote the same way; interpolation is only the `$name` and `${expression}` form.

</note>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="95. What is ValueChanged used for? How is it defined?">

`ValueChanged` is a `typedef` defined as `typedef ValueChanged<T> = void Function(T value)`. It is used to trigger rebuilds when a value changes, often in an `InheritedWidget`.

<note>

**Corrected:** the definition is right, but a `ValueChanged` triggers nothing by itself: it is the "Signature for callbacks that report that an underlying value has changed" (Flutter, n.d.-b). Whatever function is passed in decides what happens, for example a `setState` call or a `notifyListeners()` call (see Question 86).

</note>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="96. What is a typedef?">

A `typedef` is a way of specifying a new type without defining an object class. The type could be a method call, a different object, or something similar. An example of a `typedef` is `typedef ListOfInts = List<int>;`. This would allow one to use `ListOfInts` in any place that `List<int>` could be used.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="97. What is UnmodifiableListView used for?">

This is a representation of `List` in which the contents cannot be modified. It guarantees that a List would not be changed, allowing for performance improvements, and preventing accidental discrepancies in data.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="98. What are some differences and similarities between Provider, Cubit, and BLoC?">

Each of these three systems enables state management through your application. A Cubit is like a *baby* BLoC, providing similar but reduced functionality. Provider uses `ChangeNotifier`s to notify listeners about updates to the state, compared to the events being emitted from BLoC and values being streamed from a Cubit.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="99. What is cascade notation?">

Cascade notation is a shorthand method of applying many properties to an object at once. You will recognize cascade notation when you see an object with multiple `..method` calls strung together. Note the double period, known as a **cascade operator**.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="100. What are some other popular app state management solutions?">

Flutter Hooks, Riverpod, Redux, and MobX, are some other popular state management solutions in Flutter.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="101. What is a responsive layout?">

A **responsive layout** is a layout that adapts dynamically to the platform and dimensions on which it is running. This could mean using a tab bar on the phone, switching automatically to a side bar on a tablet, then using a menu bar on a desktop.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="102. Which widget can we use to build a responsive layout?">

The `LayoutBuilder` widget can be used to build a responsive layout.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="103. When building a responsive layout, what considerations should you take when choosing how to build your screen size-dependent widgets? What are some actions you can take to ensure you do not forget about accidentally removing important functionality?">

Try defining important properties using an `enum`, then using a `switch` case to ensure you do not forget any of the values.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="104. What is dart:io used for?">

This package is used to deal with files, directories, processes, sockets, WebSockets, and HTTP clients/servers.

<note>

**Corrected:** as in [Chapter 10](https://mobile-dev.peteroncode.dev/en/flutter-for-jobseekers/reactivity-and-platforms), `dart:io` is not a package but one of Dart's core libraries, "the dart:io library", which you import with `import 'dart:io';` (Dart, n.d.-e).

</note>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="105. What platform(s) can dart:io not be used on?">

Due to the nature of the package and how it deals with system-level functions and objects, it is not available when targeting the **Web** as a platform.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="106. How do you update your application’s icon?">

To manually update the app icon, you will be modifying resources in each native platform's configuration. The Flutter documentation has information on how to do this, here: [https://docs.flutter.dev/development/ui/assets-and-images#updating-the-app-icon](https://docs.flutter.dev/development/ui/assets-and-images#updating-the-app-icon).

<note>

**Corrected:** as in [Chapter 10](https://mobile-dev.peteroncode.dev/en/flutter-for-jobseekers/reactivity-and-platforms), that link now redirects to [https://docs.flutter.dev/ui/assets/assets-and-images#updating-the-app-icon](https://docs.flutter.dev/ui/assets/assets-and-images#updating-the-app-icon).

</note>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="107. Where can you find resources for designing a splash screen?">

The Flutter documentation has helpful resources for designing a splash screen. You can read more here: [https://docs.flutter.dev/development/ui/advanced/splash-screen](https://docs.flutter.dev/development/ui/advanced/splash-screen).

<note>

**Corrected:** as in [Chapter 10](https://mobile-dev.peteroncode.dev/en/flutter-for-jobseekers/reactivity-and-platforms), that link now redirects to the Android-only page [https://docs.flutter.dev/platform-integration/android/splash-screen](https://docs.flutter.dev/platform-integration/android/splash-screen) (which also covers Android 12's SplashScreen API). The iOS instructions are on a separate page: [https://docs.flutter.dev/platform-integration/ios/launch-screen](https://docs.flutter.dev/platform-integration/ios/launch-screen).

</note>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="108. What packages can be used to help ensure you have properly updated your app icon and splash screen?">

The `flutter_native_splash` package will help you update both your app icon and the splash screen.

<note>

**Corrected:** `flutter_native_splash` generates the splash screen only. [Chapter 10](https://mobile-dev.peteroncode.dev/en/flutter-for-jobseekers/reactivity-and-platforms) uses a second package, `flutter_launcher_icons`, for the app icon.

</note>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="109. What are some packages that can be used to match the look and feel of a desktop operating system, such as Windows or Linux?">

- The `yaru` package will help you build applications that feel at home on **Ubuntu Linux**,
- whereas the `adwaita` package will feel at home on any Linux distribution using **Gnome** as the desktop environment.
- Microsoft's modern design language, **Fluent**, can be replicated using the `fluent_ui` package.
- Apple's desktop-styled widgets can be found in the `macos_ui` package.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="110. What are the key differences between Android and iOS in terms of navigation principles?">

**Android** has a system-level back button, which is always available for the user. Sometimes it manifests as a gesture, while other times, it may be a physical or virtual button. **iOS** has no concept of a universal back button, leaving navigation to be performed within the applications themselves. An iOS app will commonly have some combination of **back** button (**<**) or **Done** button at the top of the screen. These navigation options are often omitted on Android, as they are unnecessary given the system back button.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="111. What is stacked navigation?">

When using a tab bar for navigation, each tab can have its own navigation stack. The tab bar will navigate to each individual navigation stack that corresponds to a given tab.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="112. What inherited widget contains information about the currently targeted platform?">

The `Theme` widget is an inherited widget that contains information about the currently targeted platform via `Theme.of(context).platform`.

<note>

**Corrected:** strictly, `Theme` is a `StatelessWidget`; the inherited widget it builds is the private `_InheritedTheme`, which `Theme.of(context)` reads (see Question 11). `Theme.of(context).platform` works as stated (flutter/flutter, n.d.).

</note>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="113. What package allows you to easily build platform-adaptive layouts?">

The `flutter_platform_widgets` package will allow you to build applications that use different widgets depending on which platform the application is running on.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="114. What is the difference between debugging and troubleshooting?">

**Troubleshooting** is identifying and solving a problem by fixing whatever issues prevented things from working in the first place. **Debugging** is the process of going step-by-step through a problem to identify and resolve any errors.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="115. What are the five steps involved in debugging?">

- **I.** Ensure the error is reproduceable. If the error is intermittent, you have not properly identified the error.
- **II.** Be certain that the problem you are debugging is the problem you need to solve.
- **III.** Check all the obvious error sources. It is easy to waste time by debugging a “complex” problem that turns out to have a very simple and obvious solution.
- **IV.** Debug the problem: isolate the problem by dividing it into working versus non-working components. Think like a computer: step through the instructions one at a time to find where the operation fails.
- **V.** If you are unable to identify the root cause of the problem, reassess the situation: what assumptions have you made that might be incorrect? Walk through the process again, taking notes and using knowledge learned from the last time.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="116. What methods can you use to log information to the debug console?">

You can log information to the debug console using the `print`, `debugPrint`, and `log` (from the `dart:developer` package) methods.

<note>

**Corrected:** as in [Chapter 11](https://mobile-dev.peteroncode.dev/en/flutter-for-jobseekers/debugging-troubleshooting-performance), `dart:developer` is not a package but a Dart core library; you import it with `import 'dart:developer';` and add nothing to `pubspec.yaml`.

</note>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="117. What is a breakpoint, and how do you create one?">

A breakpoint will pause your code execution at a given line, allowing you to inspect the runtime variables. They are created directly in your IDE (not in code), generally by clicking next to the line number. Most IDEs will represent a breakpoint with a **red dot**.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="118. What is a stack trace? What is a stack frame?">

A **stack trace** is comprised of a call stack (a list of stack frames) and shows precisely what was happening in the application when a breakpoint was hit. A **stack frame** contains information about the current running method when the previous line of code was invoked.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="119. What is an exception?">

An exception occurs when something goes wrong in the application and processing is unable to continue. In Dart, there is an `Exception` class that can be `throw`n when an exception occurs. This class contains information about the problem.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="120. What risks do you run by using a try/catch block?">

It is possible to end up in a state where an exception occurs, but processing continues anyway unless the exception is properly handled within the `catch` portion of the `try`/`catch` block. A `try`/`catch` can also obfuscate problems if not written correctly, making debugging more difficult.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="121. How do you access Flutter’s DevTools?">

If you are running your code from within Visual Studio Code, there will be a blue magnifying glass with a Flutter logo icon in the bar that pops up when you run the application. Running your code directly from the command line using the `flutter run` command will provide a URL you can access in your browser.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="122. What are the different tools available in Flutter’s DevTools?">

The different pages available in DevTools are the Widget Inspector, CPU Profiler, Memory, Performance, Network, and Logging pages. Each of these pages has many tools available.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="123. What are the two different categories of performance issues your application may encounter?">

**Time** and **Space**. Space-related performance issues are issues where your application may be using too much memory or other system resources. Time-based issues are related to how long it takes for any given frame to be processed and displayed on the screen.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="124. What is vsync, and how does it relate to your application’s performance?">

Vsync, or **vertical sync**, is a measure by which the contents of your device's display are updated at a given interval. A common refresh rate is 60fps, meaning that the screen is being redrawn every 1/60th of a second. If a frame is not processed and rendered within the `vsync` period, `jank` will occur, causing hitching in the interface.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="125. What is jank?">

Jank is when a frame takes more than the vsync period to process.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="126. What three compilation modes are available for Flutter applications? How do they differ?">

- **Debug mode**: The default mode for developing applications in. This mode allows full access to many of the debugging tools that Flutter provides, including hot reload.
- **Profile mode**: Used to assist in evaluating the performance of an application, unlocking the ability to use the Performance page in DevTools.
- **Release mode**: Strips out the debugging and performance tooling used by Flutter, maximizing the performance of the application in preparation for release.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="127. What is the difference between storage and memory?">

**Storage** is non-volatile and can be used to store files long-term. It is slower than memory but generally much more abundant. **Memory** is extremely fast, temporary (volatile) storage, which is used to hold data that the CPU is currently processing. Upon power loss, all data stored in memory is lost.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="128. When is a ListView not a ListView?">

When you pass the `shrinkWrap: true` property to a `ListView`, it essentially becomes akin to a `Column`, losing all performance benefits that a `ListView` would otherwise give you.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="129. When should you consider optimizing your application?">

Flutter is built in such a way that premature optimization of widgets is not necessary. Only when you notice **jank or excessive battery drain** should you really need to start digging into performance optimizations for your application.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="130. What are some steps you can take to optimize your application?">

- Make sure the `build()` method is not doing more work than it needs to. This method can run on every single frame if you are scrolling or animating and should not run expensive operations.
- You can also use caching to store values that would otherwise be re-fetched from external sources.
- One of the biggest things you can do to optimize performance is to simply break down large widgets into smaller ones and ensure you are passing only the necessary data to build a widget, rather than a larger object.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="131. What does open-source mean? What are some different open-source licenses?">

Open source means the code is available to inspect and modify freely. Not all open-source code is licensed the same, however. Some common licenses are BSD, Creative Commons, GPL, and MIT. Find out more about open-source licenses here: [https://opensource.org/licenses/](https://opensource.org/licenses/).

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="132. What are some factors to consider when selecting a data provider, such as a third-party API?">

Ask yourself the following questions:

- Does this API provide the data I require for my application?
- What is the cost of using this API?
- Is the provider reputable and expected to be around for a long time?

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="133. Why is it important to keep your code organized? What are some ways you can organize it?">

Keeping your code well-organized will make it easier to develop and troubleshoot features, prevent other developers from cursing your name, and add structure to your application. While there are no *rules* on how to organize your code, a suggested file layout can be found in [Chapter 12: Creating Your First Application](https://mobile-dev.peteroncode.dev/en/flutter-for-jobseekers/creating-your-first-application).

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="134. What is an enum?">

An `enum` is a Dart type that represents a fixed list of constants.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="135. What is a decorator?">

A decorator, such as `@override`, is used to add additional behavior to an object without affecting other objects of the same class.

<note>

**Corrected:** as in [Chapter 12](https://mobile-dev.peteroncode.dev/en/flutter-for-jobseekers/creating-your-first-application), Dart calls `@override` a **metadata annotation**: you "use metadata to provide additional static information about your code" (Dart, n.d.-f). An annotation adds no behavior by itself; tools such as the analyzer or a code generator read it. Adding behavior to one object without affecting others of the same class is the *decorator pattern*, a different idea: an object that wraps another object.

</note>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="136. What is code generation?">

Code generation allows us to write less code to define a class. The “full” class will be generated for us automatically when we run the appropriate command.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="137. What package can be used to generate code?">

The **Freezed** package is one of the most popular packages that can be used to generate code, but it is not the only one.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="138. What case style does Dart prefer for class names? For variable names?">

Dart prefers using **Pascal case** for class names and using **camel case** for other types of names. Pascal case `LooksLikeThis`, whereas camel case `looksLikeThis`.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="139. How can you keep secrets, such as an API key, safe?">

Secrets can be stored as environment variables, which are not stored in source control. At runtime, the variable can be read in and compiled automatically.

<note>

**Corrected:** as in [Chapter 12](https://mobile-dev.peteroncode.dev/en/flutter-for-jobseekers/creating-your-first-application), this keeps the key out of **source control**, but not out of the **app**: a value that is compiled or bundled into the app ships with every build and can be extracted from it. The `flutter_dotenv` README puts it this way: "Values loaded by this package should be treated as public client-side configuration" (flutter_dotenv, n.d.).

</note>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="140. What are some good resources for finding answers to programming questions?">

This book is a fantastic resource for many Flutter questions! There are many online resources dedicated to answering questions, too. Always start by **reading the documentation** before asking your questions to others, as it may save you (and others) a lot of time. If you are part of a developer community, you have already got a great resource at your fingertips. Otherwise, sites like Stack Overflow or even ChatGPT can answer your questions.

<warning>

Beware when using AI-assisted coding tools, however: they are known to generate non-functioning code that *looks* correct. Often, you will spend as much time debugging code that has been generated for you as you will by just reading the documentation and writing it yourself to begin with.

</warning>
</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="141. What is a singleton?">

A singleton is an object which is designed to have only a **single, global instance** in the application. You might create a singleton to be the single point of access for your code to read and write files on the filesystem, for example. This would help prevent writing to a file that is currently being read elsewhere in the application by not allowing the two actions to be performed simultaneously.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="142. Is async/await blocking?">

**No**, `async`/`await` operations are not blocking. When an `async` function is invoked, Dart will mark it as inactive and continue processing other code until the function returns a value, at which point it will be marked as active again.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="143. What is dependency injection?">

Dependency injection allows you to decouple objects, rather than hard-coding them. For example, you may have a widget that takes in a parameter for an API that it uses to make an API call. When creating the widget, you could pass the API object directly in, thereby coupling the API directly to the widget. However, this would make it difficult, if not impossible, to write tests where the API response is mocked.

By registering the API class in a dependency injector, you can pass the instance of the API, which has been registered into the widget. Then, when writing a test, you can inject a *different* API, which you can use to mock responses.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="144. What are some software design patterns?">

- **Model View Controller (MVC)**: Separates data (Model), user interface (View), and application logic (Controller).
- **Model-View-ViewModel (MVVM)**: Separates user interface (View) from business logic (Model) and presentation logic (ViewModel).
- **CLEAN**: A set of principles designed for building scalable, maintainable, and testable software. Read more here: [https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html](https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html).

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="145. Why does release mode run faster?">

In release mode, assertions, service extensions, and debugging are disabled, debugging information is stripped from the code, and **tree shaking** is performed. Tree shaking removes dead and unused code, resulting in a smaller, leaner package.

</accordion-item>

<accordion-item icon="i-lucide-circle-help" label="146. Is Flutter imperative or declarative?">

Flutter is **declarative**, rather than imperative. Read more in the documentation, here: [https://docs.flutter.dev/get-started/flutter-for/declarative](https://docs.flutter.dev/get-started/flutter-for/declarative).

<note>

**Corrected:** (checked on 2026-11-16) that link now redirects to [https://docs.flutter.dev/flutter-for/declarative](https://docs.flutter.dev/flutter-for/declarative).

</note>
</accordion-item>
</accordion>

## Conclusion

Interviewing for technical roles can be daunting, but with the tools and resources available to you in this chapter, you will be more than prepared to tackle it. Getting your first job offer as a Flutter developer is going to be a **huge accomplishment** for you, and after working so hard to get to that point, you deserve to feel proud!

Once you have accepted your job, you have got a whole new journey ahead of you. In the final chapter, we are going to talk about what it takes to be successful in your new role, as well as what you will need to do to grow in your career.

<tip>

Congratulations on your new position, and welcome to the ranks of *paid* Flutter developers!

</tip>

## References

- Dart. (n.d.-a). *The pubspec file*. Retrieved from Dart: [https://dart.dev/tools/pub/pubspec](https://dart.dev/tools/pub/pubspec) *(added, not in the book)*
- Dart. (n.d.-b). *Package dependencies*. Retrieved from Dart: [https://dart.dev/tools/pub/dependencies](https://dart.dev/tools/pub/dependencies) *(added, not in the book)*
- Dart. (n.d.-c). *Concurrency in Dart*. Retrieved from Dart: [https://dart.dev/language/concurrency](https://dart.dev/language/concurrency) *(added, not in the book)*
- Dart. (n.d.-d). *StreamController class*. Retrieved from Dart API: [https://api.dart.dev/dart-async/StreamController-class.html](https://api.dart.dev/dart-async/StreamController-class.html) *(added, not in the book)*
- Dart. (n.d.-e). *dart:io*. Retrieved from Dart: [https://dart.dev/libraries/dart-io](https://dart.dev/libraries/dart-io) *(added, not in the book)*
- Dart. (n.d.-f). *Metadata*. Retrieved from Dart: [https://dart.dev/language/metadata](https://dart.dev/language/metadata) *(added, not in the book)*
- Flutter. (n.d.-a). *InheritedWidget class*. Retrieved from Flutter API: [https://api.flutter.dev/flutter/widgets/InheritedWidget-class.html](https://api.flutter.dev/flutter/widgets/InheritedWidget-class.html) *(added, not in the book)*
- Flutter. (n.d.-b). *ValueChanged typedef*. Retrieved from Flutter API: [https://api.flutter.dev/flutter/foundation/ValueChanged.html](https://api.flutter.dev/flutter/foundation/ValueChanged.html) *(added, not in the book)*
- flutter/flutter. (n.d.). *framework.dart*, *navigator.dart*, *theme.dart*, *media_query.dart*, *material_state.dart*, *button_theme.dart*, *scroll_physics.dart* and *async.dart* (Flutter 3.29.0 source). Retrieved from GitHub: [https://github.com/flutter/flutter/tree/3.29.0/packages/flutter/lib/src](https://github.com/flutter/flutter/tree/3.29.0/packages/flutter/lib/src) *(added, not in the book)*
- flutter_dotenv. (n.d.). *flutter_dotenv*. Retrieved from pub.dev: [https://pub.dev/packages/flutter_dotenv](https://pub.dev/packages/flutter_dotenv) *(added, not in the book)*
- pub.dev. (n.d.-a). *Scoring*. Retrieved from pub.dev: [https://pub.dev/help/scoring](https://pub.dev/help/scoring) *(added, not in the book)*
- pub.dev. (n.d.-b). *isar*. Retrieved from pub.dev: [https://pub.dev/packages/isar](https://pub.dev/packages/isar) *(added, not in the book)*
- pub.dev. (n.d.-c). *pub.dev* (home page). Retrieved from pub.dev: [https://pub.dev/](https://pub.dev/) *(added, not in the book)*


## Sitemap

See the full [sitemap](https://mobile-dev.peteroncode.dev/sitemap.md) for all pages.
