Flutter is a new platform that everyone is still learning that is why most of the devs not able to find what to prepare for Flutter interview. This blog is helpful for both interviewer and candidate.
Following are the types of questions asked in the interview.
- Life Cycle & Routes
- Widgets
- Async operations
- Storage
- Platform Specific Android/iOS
- Dart
- Architecture
- Test Cases
some also related to assets, firebase, etc…
- Why Flutter? over other platforms?
- What is a Widget in Flutter? Why Flutter doesn’t have other files like XML, styles, etc…?
- Difference between a StatelessWidget and a StatefulWidget in Flutter?
- Explain the Stateful Widget Lifecycle?
- How Flutter Lifecycle different from the Android/iOS life cycle?
- How build() method works? How it rebuild itself?
- Does a new state object is created if the widget re-build?
- What is a Navigator and what are Routes in Flutter?
- What are the trees available in Flutter? Eg: Widget Tree, Element Tree…
- What is the ephemeral state? and Differentiate between ephemeral state and app state? Learn from here
- When do we use the WidgetsBindingObserver?
- Difference between SchedulerBinding and WidgetBinding? Learn from here
- How would you access StatefulWidget properties from its State?
- If the child widget gets re-initialized, does it also re-initialize the parent widget?
- How to re-initialize parent widget from child widget? Explain several ways?
- What would happen if I converted a stateless widget to Stateful Widget? Is there any performance issue?
- Flexible Vs Expanded Learn from here
- SizeBox VS Container?
- What is a Spacer widget?
- How to show/hide widgets? Learn from here
- What is the importance of a TextEditingController?
- How to shift focus to next TextField in flutter? Learn from here
- List the Visibility widgets in flutter and the differences?
- What are the ways to get data from called Widget?
- Why ListView inside Column not works?
- Differentiate between Listview and Listview.Builder? Learn from here
- How to scroll to a position in Flutter ListView?
- How to place a listview inside a SingleChildScrollView but prevent them from scrolling separately? Learn from here
- How can you update a ListView dynamically?
- When to use ShrinkWrap the property?
- Why do we use a Reverse property in a Listview?
- What is an UnmodifiableListView?
- What is SliverList and how to use it?
- How to draw Text over Image? Learn from here
- What are keys in Flutter and when should you use them?
- What are GlobalKeys?
- When should you use mainAxisAlignment and crossAxisAlignment?
- When can you use double.INFINITY?
- When to use a mainAxisSize? and diff between MainAxisSize.min andMainAxisSize.max ?
- What is the purpose of a SafeArea?
- SafeArea is basically a glorified Padding widget. If you wrap another widget with SafeArea, it adds any necessary padding needed to keep your widget from being blocked by the system status bar, notches, holes, rounded corners, and other "creative" features by manufacturers.
SafeArea(
minimum: const EdgeInsets.all(16.0),
child: Text('My Widget: ...'),
)
- How to assign min-height to the widget? Learn from here
- How to align two items on extremes - one on the left and one on the right? Learn from here
- Mention two or more operations that would require you to use or return a Future.
- Can we use Color and Decoration property simultaneously in the Container? Explain
- In order for the CrossAxisAlignment.baseline to work what is another property that we need to set?
- When should we use a resizeToAvoidBottomInset?
- Difference between a Modal and Persistent BottomSheet with an example?
- How is an Inherited Widget different from a Provider?
- What is an InheritedWidget? List some examples.
- When to use Intrinsic height?
- When to use Custom ScrollView?
- Difference between GestureDetector and InkWell? Learn from here
- What is a vsync?
- Difference between AnimationController and Animation?
- When to use a SingleTickerProviderStateMixin and TickerProviderStateMixin?
- What is Ticker, Tween and AnimatedBuilder?
- What is an AspectRatio widget used for?
- What is the purpose of ModalRoute.of()?
- Difference between RemoveUtil and PopUtil in Flutter navigation? Learn from here
- Difference between a Navigator.pushNamed and Navigator.pushReplacementNamed?
- What is the use of WidgetsBinding class?
- How to perform Hero Animation?
- Difference between Element Tree, Widget Tree and Render Tree.
- How to get responsive Flutter layouts? Learn from here
- Explain async, await , thenand Future keyword
- Use of yeild keyword?
- Why build re-triggering again and again? How to scroll to a position in Flutter ListView?
- Why FutureBuildercalled multiple times? how to resolve this? Learn from here
- What's the difference between async and async* in Dart?
- What is a Stream?
- Differentiate between StreamBuilder and FutureBuilder
- What is the difference between FutureBuilder and await?
- What are the ways to use Future Object?
- How to group multiple Streams?
- Why await is not blocking UI? Learn from here
- How to perform Syncrnonization in Flutter? Learn from here
- Differentiate between Provider and Consumer? Learn from here
- How to run foreground services?
- How to schedule a job after specific intervals?
- Difference between whenCompleted() and then().
- How to run code after Build() method execution?
- How to create an HTTP client with headers?
/// To get it done, we need one endpoint and headers and make the HTTP request.
import 'package:http/http.dart' as http;
final url = Constants.BASE_URL + 'endpoint';
final headers = {'Content-Type': 'application/x-www-form-urlencoded'};//if required
Response getResponse = await http.get(Uri.parse(url), headers: headers);
int statusCode = getResponse.statusCode;
String responseBody = getResponse.body;
print('response----' + responseBody);
- Use of http and dio package? Can we use them combined? if yes then how?
- How Compute works?
- How to perform multithreading? and return response so that widget can be updated?
- How do I implement a timer to execute code after a certain delay?
/// There are two ways to do that
/// 1. Timer
Timer(Duration(seconds: 2), () {
print("Execute this code afer 2 seconds");
});
/// 2. Future:
Future.delayed(Duration(seconds: 2), () {
print("Execute this code afer 2 seconds");
});
- Why SharedPreference commit method is deprecated? Learn from here
- How to persist data in Database ?
- How does the platform channel work?
- How to perform a background job on a specific platform?
- How to send local notifications?
- Difference between these operators "?? and ?."
- Difference between Constand final? Is there any performance issue If I select one of them over another?
- What is Extention and how to use it with the existing code?
- What is typedef in Dart?
- How to handle null conditions? and use of the '??' operator.
- Use of '=>' operator?
- Differentiate between forEachand whereclause
- What is the advantage of Factory constructor?
- Why dialog inside FutureBuilder not working? Learn from here
- Use of compareTo method? Learn from here
- Advantages and Disadvantages of using static ?
- Benefits of an abstract class with a factory constructor?
- A factory constructor allows you more control over what the constructor returns. It can return an instance of a subclass or an already existing (cached) instance. It can return different concrete implementations based on a constructor parameter:
abstract class WidgetService {
factory WidgetService(String type) {
switch (type) {
case 'a':
return ConcreteWidgetServiceA();
case 'b':
return ConcreteWidgetServiceB();
default:
return DummyWidgetServiceA();
}
}
}
- Use of extends , interface and mixin ?
- extends (inheritance) => Only one class can be inherited along with their public/protected members and behaviors.
- implements (contract) => Many classes can be implemented but we have to redefine every behavior.
- with(mixin) => Many classes can be mixed in and we can reuse the behavior of them.
Any class or abstract class can be used as a mixin. But if we declare mixin, it cannot be extended like a normal class or abstract class.
class A{} //Declaring class
mixin B{} //Declaring mixin
class C extends A{} // Valid ✅
class C implements A{} // Valid ✅
class C with A{} // Valid ✅
class C extends B{} // Invalid ❌
class C implements B{} // Valid ✅
But a mixin cannot use another mixin.
mixin C with B{} // Invalid ❌
- How to use Bloc architecture?
- How to use MVVM architecture?
- Difference between Bloc vs MVVM ?
- What is Provider state management?
- What are the different state management techniques? Learn from here
- How to mock objects? which classes used to do that?
- How to verify httprequest callbacks?
- How to catch the Exceptions?
- UI test cases Learn from here
- if we change localization to the RTL language, is it changed according to language direction
- What is the use of Equatable?
- Does dart support Method Overloading?
- How we can handle the error at the project level? Is it possible to show some widgets in that case?
- How-to Encrypt and Decrypt data while making network calls?
- Difference between getDocuments() vs snapshots() in Firebase?Learn from here
- What is the difference between hot restart and hot reload?
- How to deal with unwanted widget build? Learn from here
- What is the difference between the flutter package and the flutter plugin?
- What is the use of addPostFrameCallback ?
- How to send nested json requests to the server?
- What is the difference between 'as',' show' and 'hide' in an import statement?
- Use of export keyword?
- How to perform infinite scrolling?
- What are the ways to share images on WhatsApp, Facebook, etc?
- Difference between a Single Instance and Scoped Instance ?
- When Bad State Exception occurs? Learn from here
- How to achieve loose coupling?
- What is a pubspec file in Dart?
- How to obfuscate Flutter apps? Learn from here
- Procedure to generate release .apk(for Android) and .ipa(for iOS)
- Why a declarative UI? Learn from here
- Support by clicking the ⭐ button on the upper right of this page. ✌️
Copyright (C) 2020 MINDORKS NEXTGEN PRIVATE LIMITED
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Just make pull request. You are in!