Flutter Interview Questions
I had multiple interviews with organisations while looking for a job in Flutter, therefore in this blog I will go over all of the questions that were asked as well as ones that I prepared. You may occasionally be asked to know some fundamentals about an app’s Native functionality, whether it be for Android or iOS.
Generally in the Flutter job interviews there are 3–4 rounds.
1st round: Assignment or Basic knowledge of Flutter
2nd round: Basic/Advance Flutter questions/Basic Native questions
3rd and 4th round: Advance Flutter questions/Native Mobile questions/System Design of Mobile/Architecture level questions
Flutter Assignments are given to check the candidate’s coding technique some examples are: Todo(using StateManagement or DB), tic-tac-toe, newsApi(using StateManagement or DB), Draw particular Shape using CustomPainter
I’ve answered to some questions here, while in others I’ve provided a link to the topic and tried to put questions of a similar nature together.
Q1: Lifecycle of Stateful Widget
A1: https://flutterbyexample.com/lesson/stateful-widget-lifecycle
Q2: Keys in Flutter: Local, Global & Unique
A2: https://www.raywenderlich.com/22416843-unlocking-your-flutter-widgets-with-keys
Q3: Flutter architectural overview
A3: https://docs.flutter.dev/resources/architectural-overview
Q4: Keyword: static, final & const
A4: https://stackoverflow.com/a/53947036
Q5: Difference between Hot reload and Hot restart
A5: https://stackoverflow.com/a/61787777
Q6: Explain BuildContext
A6: https://api.flutter.dev/flutter/widgets/BuildContext-class.html
Q7: MediaQuery
A7: https://api.flutter.dev/flutter/widgets/MediaQuery-class.html
Q8: How does Flutter run the code on Android?
A8: The NDK for Android compiles the C and C++ code of the flutter engine. Both the SDK's and your Dart code are compiled into native, ARM, and x86 libraries using the AOT (ahead-of-time) compiler. These libraries are included in an Android "runner" project, and the entire item (or artefact) is packaged as an .apk file. The flutter library is loaded when the app is launched.
Q9: How does Flutter run the code on iOS?
A9: LLVM is used to compile the C and C++ code in the Flutter Engine (low level virtual machine — a compiling technology). AOT (ahead-of-time) compiles both the SDK’s and your Dart code into a native, ARM library. The ARM library is included in the iOS project “runner,” and the entire code base is packaged as an iOS App Store Package file .ipa. The flutter library is loaded when the app is launched.
Q10: Stateful vs Stateless Widget
A10: https://medium.com/flutter-community/flutter-stateful-vs-stateless-db325309deae
Q11: How does Dart AOT work?
A11: https://dart.dev/overview#platform
Q12: What is the difference between double.INFINITY and MediaQuery?
A12: double.infinity: As big as my parent allows and MediaQuery: As big as device screen.
Q13: Internationalisation and localisation
A13: https://docs.flutter.dev/development/accessibility-and-localization/internationalization
Q14: What is Dart and why does Flutter use it?
A14: Dart is a garbage-collected object-oriented programming language.
Dart is an AOT compiled native code that allows the majority of Flutter to be written in Dart.
Dart can also be JIT-compiled for lightning-fast development cycles and game-changing workflows (such as Flutter’s rapid reload).
Dart’s declarative nature allows Flutter to avoid the need for a separate declarative layout language like JSX or XML, as well as separate visual interface builders.
Q15: What are the benefits of Flutter?
A15: Learn Once write Everywhere
Cross-platform Development
Faster Development
Good Community
Live and Hot Reloading
Native Performance
Provides Native Look and Feel
Expressive and versatile UI
Q16: Semantics
A16: https://api.flutter.dev/flutter/widgets/Semantics-class.html
Q17: WidgetsBindingObserver
A17: WidgetsBindingObserver check when the system puts the app in the background or returns the app to the foreground
Q18: Null Safety in Dart
A18: https://codewithandrea.com/videos/dart-null-safety-ultimate-guide-non-nullable-types/
Q19: Null-aware operators
A19: ?.
, ??
, & ??=
Q20: Tree shaking
Q21: SizedBox VS Container?
A21: https://stackoverflow.com/a/55716668
Q22: What does resizeToAvoidBottomInset do?
A22: If an onscreen keyboard is presented above the scaffold, using resizeToAvoidBottomInset, body can be adjusted to avoid overlaying the keyboard, allowing widgets inside the body to be seen.
Q23: Flow analysis: Promotion, Definite Assignment
Q24: What is vsync?
A24: Vsync keeps track of the screen so that Flutter doesn’t have to render the animation while the screen is not there.
Q25: Ticker
A25: https://api.flutter.dev/flutter/scheduler/Ticker-class.html
Q26: TickerProvider
A26: https://api.flutter.dev/flutter/scheduler/TickerProvider-class.html
Q27: What are tween animations?
A27: https://api.flutter.dev/flutter/animation/Tween-class.html
Q28: Mixins
A28: When we wish to share a behaviour across different classes that aren’t in the same class hierarchy, or when it’s not practical to implement such a behaviour in a superclass, mixins come in handy.
Q29: Expanded vs Flexible
A29: https://stackoverflow.com/a/52646036
Q30: WillPopScope
A30: WillPopScope that allows us to control the back button navigation.
Q31: Spread operator?
A31: https://www.woolha.com/tutorials/dart-using-triple-dot-spread-operator-examples
Q32: When do we use profile mode?
A32: When you wish to analyse performance, you use profile mode. Profile mode on mobile is similar to release mode, with the following exceptions: — Some service extensions have been enabled, such as the one that enables the performance overlay. — Tracing is enabled, and debugging tools (such as DevTools) that support source-level debugging can connect to the process.
Q33: Why is exit(0) not preferred for closing an app?
A33: https://stackoverflow.com/a/57534684
Q34: What is .of method in Flutter and when would you use them ?
A34: https://stackoverflow.com/a/65272618
Q35: How to control the visibility of widget?
Q36: Single Instance and Scoped Instance ?
A36: https://codewithandrea.com/articles/global-access-vs-scoped-access/
Q37: Runes in dart
A37: https://api.dart.dev/stable/2.17.4/dart-core/Runes-class.html
Q38: then vs whenComplete
A38: When the longer term completes with a mistake or not, .whenComplete fires a function, whereas .then returns a replacement Future with the results of the decision to onValue (if this future completes with a value) or onError (if this future completes with an error).
Q39: Isolates
A39: https://blog.codemagic.io/understanding-flutter-isolates/
Q40: Parallellism vs Concurrency ?
A40: https://stackoverflow.com/a/53901907
Q41: Package vs plugin
A41: A “package” is a collection of Dart code.
Dart and Native code (kotlin/js/swift) are combined in a “plugin.”
Q42: What if we didn’t dispose controllers?
A42: When a state object is eliminated, the dispose method is used to release the memory assigned to variables.
For example ,if you’re utilising an animation in your app, you’ll need to free up memory assigned to the animationController. Otherwise, the PlayStore and AppStore may issue a memory leaking warning to your programme.
Q43: Flutter engine
A43: https://github.com/flutter/engine/blob/main/README.md
Q44: State restoration
Q45: Constraints
A45: https://docs.flutter.dev/development/ui/layout/constraints
Q46: async vs async* in Dart?
A46: async gives you a Future while async* gives you a Stream.
Q47: Slivers
A47: https://medium.com/flutter/slivers-demystified-6ff68ab0296f
Q48: Custom Painter
A48: https://medium.com/flutter-community/a-deep-dive-into-custompaint-in-flutter-47ab44e3f216 from Deven Joshi
Q49: Ephemeral/App state
A49: https://docs.flutter.dev/development/data-and-backend/state-mgmt/ephemeral-vs-app
Q50: Inherited widget
A50: https://api.flutter.dev/flutter/widgets/InheritedWidget-class.html.
Q51: How is InheritedWidget different from Provider?
A51: InheritedWidgets are used to build the provider. You’ll have hundreds of unnecessary repeating lines if you don’t use provider. Provider simply takes the logic of InheritedWidgets and pares it down to the minimum of boilerplate.
Q52: Value notifier
Q53: What do you mean by Streams and its types?
A53: https://medium.com/flutter-community/flutter-stream-basics-for-beginners-eda23e44e32f
Q54: Throttle vs Debounce
A54: https://stackoverflow.com/a/25991510
Q55: How to use extensions?
A55: https://dart.dev/guides/language/extension-methods
Q56: 3 Trees in Flutter
A56: https://medium.com/@omlondhe/flutters-3-tree-architecture-9263b2bd50d1
Q57: How to change state of view in Stateless widget without using any external package?
A57: Stream and ValueListenable
Q58: How do you create a factory?
A58: https://dart.dev/guides/language/language-tour#factory-constructors
Q59: Singleton class
A59: https://stackoverflow.com/a/12649574
Q60: Design Patterns
A60: Learn Design Patterns from Mangirdas Kazlauskas, most asked ones are Singleton, Adapter, Factory, Observer and Composite.
Q61: SOLID DRY KISS Principles
A61: https://vpodk.medium.com/principles-of-software-engineering-6b702faf74a6
Q62: Widgets
A62: In interviews these following widget’s usage and example could be asked: UnconstrainedBox, ConstrainedBox, FittedBox, LayoutBuilder, IntrinsicWidth, IntrinsicHeight
Q63: Splash Screen
A63: https://docs.flutter.dev/development/ui/advanced/splash-screen
Q64: Miscellaneous
A64: Some Miscellaneous flutter topics:-
Following are the companies who hires for Flutter, most of these companies have team based in INDIA itself: Cardekho, Even, Josh Talks, Geekyants, Awign, Park+, Grab, Gojek, Tokopedia, Frontrow, Jio, YML, Squareboat, Inmobi, Junglee games, Zest Money, Vahak, CoinDCX, Appyboard, RuleZero(Zerodha Backed), CRED, Smallcase, Tickertape, Nas Academy,GetStream, Innovaccer, CaptainFresh, Webengage, PasarPolis, Amazon, Sav.money, Clipboard health, India Today, Hero Vired, Tide, Yatra, Yellow Class, Slice, GreyOrange, Fello, Appyhigh.
Please hit the clap icon 👏 and share this article with your friends if you find it helpful, as it will encourage me to create more.
Feel free to connect with me on social media platforms for any doubts regarding Flutter.