50+ New Flutter Interview Questions

Flutter interview questions and answers

Are you a flutter developer and looking for flutter interview questions and answers? Then this article is for you. This article contains curated questions on flutter. So, make sure to read till the end.

What is Flutter?

Flutter is an open-source UI toolkit from Google for crafting beautiful, natively compiled applications for desktop, web, and mobile from a single codebase. Flutter apps are built using the Dart programming language.

What is flutter used for?

Flutter is used to create fast, beautiful, mobile apps that are compiled using the same programming language and code base

Is Flutter an SDK?

Yes, Flutter is an SDK.

Is Flutter a frontend or a backend?

Flutter is a front-end development framework.

Is Dart language necessary for Flutter?

To use the Dart language to code apps, developers have to know Dart. iPhone applications using the Flutter platform use the Dart language for coding.

What build modes are available in Flutter?

Flutter has 3 build modes, Debug Mode, Profile Mode, and Release Mode. 

In What technology is Flutter built?

Flutter is built using C, C++, Skia – 2D rendering engine, and Dart-object-oriented language. 

What is a pubspec file in Dart?

The pubspec file manages the assets and dependencies for a Flutter app.

Flutter Interview questions for 1 year of experience

What’s the difference between a hot reload and a hot restart?

Hot reload maintains the app state while updating the UI almost instantaneously. Hot restart, by comparison, takes a little longer because it resets the app state to its initial conditions before updating the UI. Both of these are faster than doing a full restart, which requires recompiling the app.

When making significant changes, you need to stop and restart the app. On rare occasions, you might have to delete the app from your simulator/emulator or device and reinstall it.

What is the difference between StatelessWidget and StatefulWidget?

StatelessWidget is an immutable class that acts as a blueprint for some parts of the UI layout. You use it when the widget doesn’t change while displaying and, therefore, has no State.

StatefulWidget is also immutable, but it’s coupled with an State object that allows you to rebuild the widget with new values whenever calling setState(). Use StatefulWidget whenever the UI can change dynamically.

If the state becomes more complex or the same state is in two different widgets, then you should consider a more sophisticated state management solution.

You can read more about stateless and stateful widgets in the Flutter docs.

What is the difference between WidgetsApp and MaterialApp?

WidgetsApp provides basic navigation. Together with the widgets library, it includes many of the foundational widgets that Flutter uses.

MaterialApp and the corresponding material library is a layer built on top of WidgetsApp and the widgets library. It implements Material Design, which gives the app a unified look and feels on any platform or device. The material library has many additional widgets that come with it.

You certainly aren’t required to use MaterialApp in your project. You can use CupertinoApp to make iOS users feel at home, or you can even build your own set of custom widgets to fit your brand.

Can you nest a Scaffold? Why or why not?

Yes, you can absolutely nest a Scaffold. That’s the beauty of Flutter. You control the entire UI.

A scaffold is just a widget, so you can put it anywhere a widget might go. By nesting a Scaffold, you can layer drawers, snack bars, and bottom sheets.

Flutter Interview questions for 2 years of experience

Does Flutter support Material Design?

Yes! The Flutter and Material teams collaborate closely, and Material is fully supported.

Does Flutter come with a testing framework?

Yes, Flutter provides APIs for writing unit and integration tests.

Explain BuildContext.

BuildContexts are used to identify or locate widgets in widget trees. Each widget has its own BuildContext, i.e., one BuildContext per widget. Basically, we’re using it to find references to other widgets and themes. In addition, you can utilize it to interact with widget parents and access widget data.

Define App state.

App State may also be referred to as a shared state or application state. It is possible to share app states across sections of your app and maintain user sessions in the same way.

Explain packages and plugins in Flutter.

A package is a collection of classes, interfaces, and sub-packages that enable the creation of modular code that can be shared easily among users. Applications can be quickly developed using packages instead of developing everything from scratch. You can import new widgets or functionality into an app using a package in Flutter. There is a slight difference between plugins and packages as given below:

Plugins: Using native code, enables more usability and makes it easier to use the device.  
Packages:  These are new code or components written in the dart programming language.

Packages and plugins are often referred to as packages on pub.dev, and specific distinctions between the two are made only during the creation of a new package.

Flutter Interview questions for 3 years of experience

What is the factory method in Flutter?

The factory method is referred to as a creational design pattern that provides an interface for creating objects in a superclass but allows subclasses to alter the type of objects that will be created. Also known as virtual constructors.

Is multiple inheritance possible in Flutter?

Unlike Java, Dart also doesn’t support multiple inheritance

What is context in Flutter?

Context is a link to the location of a widget in the tree structure of widgets. – Context can belong to only one widget. – If a widget has child widgets, then the context of the parent widget becomes the parent context for the contexts of direct child elements.

What is snapshot data in Flutter?

A library that can be used to implement data classes and simplifies the conversion of JSON to data classes

What is StreamBuilder in flutter?

StreamBuilder is a widget that builds itself based on the latest snapshot of interaction with a stream.

What is a builder in Flutter?

A builder is a Flutter design pattern in which the construction code of a widget is defined outside of its class. Builder functions are callback interfaces that pass data (often layout-specific) to the parent widget which returns a child based on that data.

Can you use multiple scaffold in Flutter?

Yes, but that is precisely what we want when we make two separate screens, each one with its own Scaffold

What is an InheritedWidget?

Flutter Interview questions for 5 years of experience

What is dependency injection in flutter

Dependency injection in Flutter is a technique in which one object supplies the dependencies of another object. A dependency is an object that can be used in the class. It can be a Network service, Database service, Location service etc

Define setState()

We use it for managing the local state in a similar stateful widget and its child. The downside is everything is in the same class like UI code, business logic, and mixin UI, which splits clean code principles.

Explain BuildContext.

BuildContexts are used to identify or locate widgets in widget trees. Each widget has its own BuildContext, i.e., one BuildContext per widget. Basically, we’re using it to find references to other widgets and themes. In addition, you can utilize it to interact with widget parents and access widget data.

What is the difference between InkWell and GestureDetector?

The main difference between InkWell and GestureDetector lies in the Material widget. InkWell must have a Material Widget as an ancestor. However, there is no such compulsion for the GestureDetector widget. Otherwise, in many ways, these two widgets share common features

What are Null-aware operators in Flutter?

Dart offers some handy operators for dealing with values that might be null.

a.One is the ??= assignment operator, which assigns a value to a variable only if that variable is currently null

b.Another null-aware operator is ??, which returns the expression on its left unless that expression’s value is null, in which case it evaluates and returns the expression on its right

What is the use of Navigation.push and Navigation.pop function?

The push method is used to add a route to the stack of routes managed by the navigator. The pop method is used to remove the current route from the stack of routes managed by the navigator.

Flutter bloc interview questions

What is BLoC Pattern?

BLoC stands for Business Logic Components. It helps in managing the state and makes access to data from a central place in your project. The gist of BLoC is that everything in the app should be represented as a stream of events: widgets submit events; other widgets will respond. BLoC sits in the middle, managing the conversation.

What kinds of design patterns can be leveraged with BLoC?

BLoC can be used with a variety of design patterns, but it is most commonly used with the Model-View-Controller (MVC) and Model-View-Presenter (MVP) patterns.

What’s the best way to fire events into your Bloc? Should the bloc class have access to the event stream directly or should it go through a repository?

The best way to fire events into your Bloc is through a repository. This will allow you to keep your Bloc class decoupled from the event stream, and will also make it easier to unit test your Bloc.

Why should we not make `setState` calls inside our Bloc classes?

The main reason for this is that `setState` calls are asynchronous, which means that they can’t be guaranteed to happen in a specific order. This can lead to unexpected results, especially when multiple `setState` calls are made in quick succession. Additionally, `setState` calls can cause performance issues if they are called too frequently.

Can you explain what sinks and streams are?

In a nutshell, streams are a way of handling asynchronous data, while sinks are a way of handling data that is being added to a stream. Streams can be thought of as a pipe, through which data flows. Sinks are like the tap that controls the flow of data into the stream.

What are some common Bloc patterns that are used when developing an application in Flutter?

Some common Bloc patterns that are used when developing an application in Flutter include the following:

-The use of a StreamController to emit events that will be processed by the Bloc.
-The use of a StreamBuilder to listen for events emitted by the StreamController and rebuild the UI in response to those events.
-The use of a Sink to provide input to the Bloc from outside sources.
-The use of a StatefulWidget to manage the state of the Bloc.

Flutter BLoC Interview Questions and Answers

What is Rune in Dart?

A rune can be defined as an integer used to represent any Unicode code point. As a Dart string is a simple sequence of UTF-16 code units, 32-bit Unicode values in a string are represented using a special syntax. The String class in the dart:core library gives ways to access runes

What is an enum in dart?

Enumerated types (also known as enumerations or enums) are primarily used to define named constant values. The enum keyword is used to define an enumeration type in Dart. The use case of enumeration is to store finite data members under the same type of definition

What is assert dart?

The assert statement is a useful tool to debug the code and it uses a boolean condition for testing. If the boolean expression in the assert statement is true then the code continues to execute, but if it returns false then the code ends with an Assertion Error

Flutter is a new platform that everyone is still learning which is why most of the devs are not able to find what to prepare for the Flutter interview. This blog is helpful for both the interviewer and the candidate.

The following are the types of questions asked in the interview.

  1. Life Cycle & Routes
  2. Widgets
  3. Async operations
  4. Storage
  5. Platform Specific Android/iOS
  6. Dart
  7. Architecture
  8. Test Cases

some are also related to assets, firebase, etc…

1. Life Cycle & Routes

  • 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?

2. Widgets

  • 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.
  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

3. Async operations

  • 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");

4. Storage

  • Why SharedPreference commit method is deprecated? Learn from here
  • How to persist data in Database ?

5. Platform Specific Android/iOS

  • How does the platform channel work?
  • How to perform a background job on a specific platform?
  • How to send local notifications?

6. Dart

  • 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();
        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 ❌

7. Architecture

  • 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

8. Test Cases

  • 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

Quote Book App Flutter Tutorial – Your Step by Step Guide to Create a Beautiful Quote App

What is Flutter?

In this article, we will share this flutter tutorial with you. if you are a beginner then this will help you a lot to learn flutter app development faster and easy way.

Flutter is a cross-platform mobile app development framework created by Google. It allows developers to create native-looking Android and iOS apps with a single codebase. Flutter apps are written in the Dart programming language and make use of the Flutter widgets library.

What are the benefits of using Flutter?

There are many benefits of using Flutter, including:

  • Flutter is free and open source.
  • Flutter is easy to use and learn
  • Flutter is cross-platform, meaning that you can write one codebase that will run on both iOS and Android.
  • Flutter is fast and responsive.
  • Flutter has a rich set of widgets and libraries.
  • Flutter is backed by Google.
  • Flutter has great documentation

How to create a Flutter app?

There are a few steps you need to take in order to create a Flutter app.

  • First, you need to install the Flutter SDK.
  • Next, you need to create a new project using the “flutter create” command.
  • Once you have a project, you can edit the main.dart file to add your own code.
  • Finally, you can run your app on a device or simulator by using the “flutter run” command.

Quote Book App Flutter Tutorial: How to Create a Beautiful and Functional App in Minutes!

1. Introduction

In this flutter tutorial, we will create a simple quote book app using Flutter.

2. Setting up the development environment

There are a few different ways to set up a Flutter development environment, but we recommend using Android Studio with the Flutter plugin. This will give you access to all the tools you need to develop Flutter apps, including a powerful code editor, a visual layout editor, and a device simulator. But you can also use the VSCode with Flutter and Dart extension

3. Creating the project

  • Open Android Studio
  • Click new flutter project
  • Select Flutter from the list and click next
  • Enter the project name Quote Book
  • Select the project location
  • Enter project descriptions
  • Enter your project package name like com.fluttertalk.quotebook
  • Click the Finish button.

4. Implementing the design

Add dependencies into the pubspec.yaml file

share: ^0.6.3+3 
google_fonts: ^1.1.0 
clipboard_manager: ^0.0.4 
- assets/images/

Create a model folder in the lib folder and then create a dart file name quote.dart

Create another dart file name home.dart

5. Adding functionality

6. Testing and deploying the app

7. Conclusion

This is the end of this flutter tutorial. Learn about CRUD Flutter Tutorial Using Drift Package

Download Source Code GitHub

Happy Coding!

Flutter Splash Screen Tutorial

Splash Screen is the very first screen that we see after launching an application. It is also called the launch screen. We will implement three main methods to add a splash screen to our app. So in this tutorial, we will create Flutter Splash Screen by using flutter_native_splash package.

Customize Flutter’s default white native splash screen with background color and splash image. We can also create a full-screen animated splash screen using the Lottie package

How To Make Splash Screen in Flutter

This will add a line like this to your package’s pubspec.yaml (and run an implicit flutter pub get):

  flutter_native_splash: ^2.2.14

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

import 'package:flutter_native_splash/flutter_native_splash.dart';

Setting the splash screen

Customize the following settings and add them to your project’s pubspec.yaml file or place in a new file in your root project folder named flutter_native_splash.yaml.

  # This package generates native code to customize Flutter's default white native splash screen
  # with background color and splash image.
  # Customize the parameters below, and run the following command in the terminal:
  # flutter pub run flutter_native_splash:create
  # To restore Flutter's default white splash screen, run the following command in the terminal:
  # flutter pub run flutter_native_splash:remove

  # color or background_image is the only required parameter.  Use color to set the background
  # of your splash screen to a solid color.  Use background_image to set the background of your
  # splash screen to a png image.  This is useful for gradients. The image will be stretch to the
  # size of the app. Only one parameter can be used, color and background_image cannot both be set.
  color: "#42a5f5"
  #background_image: "assets/background.png"

  # Optional parameters are listed below.  To enable a parameter, uncomment the line by removing
  # the leading # character.

  # The image parameter allows you to specify an image used in the splash screen.  It must be a
  # png file and should be sized for 4x pixel density.
  #image: assets/splash.png

  # The branding property allows you to specify an image used as branding in the splash screen.
  # It must be a png file. It is supported for Android, iOS and the Web.  For Android 12,
  # see the Android 12 section below.
  #branding: assets/dart.png

  # To position the branding image at the bottom of the screen you can use bottom, bottomRight,
  # and bottomLeft. The default values is bottom if not specified or specified something else.
  #branding_mode: bottom

  # The color_dark, background_image_dark, image_dark, branding_dark are parameters that set the background
  # and image when the device is in dark mode. If they are not specified, the app will use the
  # parameters from above. If the image_dark parameter is specified, color_dark or
  # background_image_dark must be specified.  color_dark and background_image_dark cannot both be
  # set.
  #color_dark: "#042a49"
  #background_image_dark: "assets/dark-background.png"
  #image_dark: assets/splash-invert.png
  #branding_dark: assets/dart_dark.png

  # Android 12 handles the splash screen differently than previous versions.  Please visit
  # https://developer.android.com/guide/topics/ui/splash-screen
  # Following are Android 12 specific parameter.
    # The image parameter sets the splash screen icon image.  If this parameter is not specified,
    # the app's launcher icon will be used instead.
    # Please note that the splash screen will be clipped to a circle on the center of the screen.
    # App icon with an icon background: This should be 960×960 pixels, and fit within a circle
    # 640 pixels in diameter.
    # App icon without an icon background: This should be 1152×1152 pixels, and fit within a circle
    # 768 pixels in diameter.
    #image: assets/android12splash.png

    # Splash screen background color.
    #color: "#42a5f5"

    # App icon background color.
    #icon_background_color: "#111111"

    # The branding property allows you to specify an image used as branding in the splash screen.
    #branding: assets/dart.png

    # The image_dark, color_dark, icon_background_color_dark, and branding_dark set values that
    # apply when the device is in dark mode. If they are not specified, the app will use the
    # parameters from above.
    #image_dark: assets/android12splash-invert.png
    #color_dark: "#042a49"
    #icon_background_color_dark: "#eeeeee"

  # The android, ios and web parameters can be used to disable generating a splash screen on a given
  # platform.
  #android: false
  #ios: false
  #web: false

  # Platform specific images can be specified with the following parameters, which will override
  # the respective image parameter.  You may specify all, selected, or none of these parameters:
  #image_android: assets/splash-android.png
  #image_dark_android: assets/splash-invert-android.png
  #image_ios: assets/splash-ios.png
  #image_dark_ios: assets/splash-invert-ios.png
  #image_web: assets/splash-web.png
  #image_dark_web: assets/splash-invert-web.png
  #background_image_android: "assets/background-android.png"
  #background_image_dark_android: "assets/dark-background-android.png"
  #background_image_ios: "assets/background-ios.png"
  #background_image_dark_ios: "assets/dark-background-ios.png"
  #background_image_web: "assets/background-web.png"
  #background_image_dark_web: "assets/dark-background-web.png"
  #branding_android: assets/brand-android.png
  #branding_dark_android: assets/dart_dark-android.png
  #branding_ios: assets/brand-ios.png
  #branding_dark_ios: assets/dart_dark-ios.png

  # The position of the splash image can be set with android_gravity, ios_content_mode, and
  # web_image_mode parameters.  All default to center.
  # android_gravity can be one of the following Android Gravity (see
  # https://developer.android.com/reference/android/view/Gravity): bottom, center,
  # center_horizontal, center_vertical, clip_horizontal, clip_vertical, end, fill, fill_horizontal,
  # fill_vertical, left, right, start, or top.
  #android_gravity: center
  # ios_content_mode can be one of the following iOS UIView.ContentMode (see
  # https://developer.apple.com/documentation/uikit/uiview/contentmode): scaleToFill,
  # scaleAspectFit, scaleAspectFill, center, top, bottom, left, right, topLeft, topRight,
  # bottomLeft, or bottomRight.
  #ios_content_mode: center
  # web_image_mode can be one of the following modes: center, contain, stretch, and cover.
  #web_image_mode: center

  # The screen orientation can be set in Android with the android_screen_orientation parameter.
  # Valid parameters can be found here:
  # https://developer.android.com/guide/topics/manifest/activity-element#screen
  #android_screen_orientation: sensorLandscape

  # To hide the notification bar, use the fullscreen parameter.  Has no effect in web since web
  # has no notification bar.  Defaults to false.
  # NOTE: Unlike Android, iOS will not automatically show the notification bar when the app loads.
  #       To show the notification bar, add the following code to your Flutter app:
  #       WidgetsFlutterBinding.ensureInitialized();
  #       SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom, SystemUiOverlay.top]);
  #fullscreen: true

  # If you have changed the name(s) of your info.plist file(s), you can specify the filename(s)
  # with the info_plist_files parameter.  Remove only the # characters in the three lines below,
  # do not remove any spaces:
  #  - 'ios/Runner/Info-Debug.plist'
  #  - 'ios/Runner/Info-Release.plist'

Run the package

After adding your settings, run the following command in the terminal:

flutter pub run flutter_native_splash:create

Set up app initialization (optional)

By default, the splash screen will be removed when Flutter has drawn the first frame. If you would like the splash screen to remain while your app initializes, you can use the preserve() and remove() methods together. Pass the preserve() method the value returned from WidgetsFlutterBinding.ensureInitialized() to keep the splash on the screen. Later, when your app has initialized, make a call to remove() to remove the splash screen.

import 'package:flutter_native_splash/flutter_native_splash.dart';

void main() {
  WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
  FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
  runApp(const MyApp());

// whenever your initialization is completed, remove the splash screen:

Full Example Code

flutter pub add flutter_native_splash
import 'package:flutter/material.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart';

void main() {
  WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
  FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
  runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
      home: const MyHomePage(title: 'Flutter Demo Home Page'),

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".

  final String title;

  State<MyHomePage> createState() => _MyHomePageState();

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      // This call to setState tells the Flutter framework that something has
      // changed in this State, which causes it to rerun the build method below
      // so that the display can reflect the updated values. If we changed
      // _counter without calling setState(), then the build method would not be
      // called again, and so nothing would appear to happen.

  void initState() {

  void initialization() async {
    // This is where you can initialize the resources needed by your app while
    // the splash screen is displayed.  Remove the following example because
    // delaying the user experience is a bad design practice!
    // ignore_for_file: avoid_print
    print('ready in 3...');
    await Future.delayed(const Duration(seconds: 1));
    print('ready in 2...');
    await Future.delayed(const Duration(seconds: 1));
    print('ready in 1...');
    await Future.delayed(const Duration(seconds: 1));

  Widget build(BuildContext context) {
    // This method is rerun every time setState is called, for instance as done
    // by the _incrementCounter method above.
    // The Flutter framework has been optimized to make rerunning build methods
    // fast, so that you can just rebuild anything that needs updating rather
    // than having to individually change instances of widgets.
    return Scaffold(
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(widget.title),
      body: Center(
        // Center is a layout widget. It takes a single child and positions it
        // in the middle of the parent.
        child: Column(
          // Column is also a layout widget. It takes a list of children and
          // arranges them vertically. By default, it sizes itself to fit its
          // children horizontally, and tries to be as tall as its parent.
          // Invoke "debug painting" (press "p" in the console, choose the
          // "Toggle Debug Paint" action from the Flutter Inspector in Android
          // Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
          // to see the wireframe for each widget.
          // Column has various properties to control how it sizes itself and
          // how it positions its children. Here we use mainAxisAlignment to
          // center the children vertically; the main axis here is the vertical
          // axis because Columns are vertical (the cross axis would be
          // horizontal).
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
              style: Theme.of(context).textTheme.headline4,
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.

If you need a custom splash screen using a custom image you need to follow this documentation of this package in detail.

Flutter splash screen example GitHub

Best Flutter CRUD Tutorial Using Drift Package

We have different DBMS like Sqflite, Hive, Drift, etc. Some are SQL-based, and some are NoSQL-based. Each of them has its pros and cons, but I don’t want to talk about them here.

Flutter Drift Package Step-to-Step Implementation Guide

The Drift Package is used in both Dart and Flutter applications and supports all platforms. Developers can write queries in Dart or SQL.

The best part of this package is its well-organized documentation which anyone can understand.

Adding The Dependencies

Add the following to your pubspec.yaml:

How to define a Table using drift

You may wonder if all these packages are necessary. Each of them has its own use. As I said, the Drift package is our core package. Drift is built on SQLite and sqlite3_flutter_libs helps to develop Android or iOS apps. If you don’t create a Flutter app, you may not use it (at your own risk). All local databases are stored somewhere on the device, so you need a place to store the data, where the path and path_provider packages help the developer. Finally, drift_devand is used to generate the code build_runnera.

Flutter CRUD Tutorial

After installing Drift package, it’s time to put the tables into action. I have used the drift package in one of my projects and now I want to share my experience with you. Here are Category and note tables:

Depending on the table field, IntColumn, TextColumn, BoolColumn, DateTimeColumn and RealColumn can be used. If you want to set a default value for a column, you can use the withDefault function and pass it a value. The named functions are used when you want to set a different name for a field from its getter name. I think it goes without saying, so let’s talk about primary keys and foreign keys.

To specify primary keys one way is to override primaryKey getter and introduce considered columns. There is a reference method in drift to express foreign key(s) in your table (like categoryId in Note table).

This method has 2 optional parameters to describe Referential Actions (onDeleteand onUpdate). Be aware that, in sqlite3, you must enable foreign key references. They need to be enabled with PRAGMA foreign_keys = ON. I will show you soon.

After designing tables, we need a class to manage our database and write queries. Inside @DrfitDatabase annotation, we should introduce the tables and views (if we have them) that we defined before. If we want to make special configurations when the database is being created or upgraded, we can override the migrationmethod. This function returns a MigrationStrategy that receives 3 functions as input; onCreateonUpgrade and beforeOpen.

Don’t forget to run the below command to generate database.g.dart file:

flutter pub run build_runner build

After this command is executed successfully, we have 2 versions for each of our tables; the Data version and the Companion version (for e.g NoteData and NoteCompanion).

Now I want to write queries. As you know we have 4 kinds of operations: insertupdatedelete and select. In addition, we have where clause, join clause, etc. All of these can be done easily with some methods. In the following, I wrote a small example for each of them.

  1. The following code adds a category to the Category table. It’s simple, you just have to be careful that the insert function receives a CategoryCompanionobject.

2. Updating a record is as easy as A, B, and C. Drift package itself considers the places where the PKs are equal and performs the update. Unlike the insert function, this function receives the CategoryData version.

3. The next thing is about deleting a record from a table. You know, to delete a record, we need a condition that we don’t delete all the records by mistake. One of the places where the where function can stand out is exactly here to specify omissions.

4. And finally it’s time to select. The query you see in the figure below is for searching between notes. In addition, I joined the two tables as needed in my project; There are also other types of joins in drift.

An important point is that when you join two tables together, the output of your query is none of the previous two tables, in such a situation, Drift will return you a list of TypedResults, and you have to parse the data. These events do not necessarily happen during joining tables; You may decide to add a column to your output (for example, due to the use of Aggregation functions or something else) in a query. Here too, the result needs to be parsed.

Best Way To Use Flutter ListView Long List

In the previous post, We have learned a simple way of creating a static Flutter listview. But, If the number of items in the list is long and dynamically generated, then a simple listview will not work. So, In this post, we are going to see the implementation of the Flutter ListView Long List Widget.

ListView is a very important widget in a flutter. It is used to create a list of children But when we want to create a list recursively without writing code again and again then ListView. builder is used instead of ListView. ListView. the builder creates a scrollable, linear array of widgets.

At the end of this post, We will be able to see our app as shown in the screenshot below:

Working with a Flutter ListView long list

Now, let’s start our tutorial by creating a brand new flutter project in Android Studio by navigating to File => New => New Flutter Project

Now remove all the default code, and write the following main() function from scratch:

Creating Long ListView

In order to create a long and dynamic listview, we will have to follow these easy two steps:

Creating Data Source

Converting the Data Source into widgets

Creating Data Source

Here, Data Source will act as a source of data that will populate your listview. Either it can be a database source or dynamically (programmatically generated) data sets. It can also be a file source such as JSON file etc.

In this tutorial, we will be dynamically generating lists of 500 items as shown below-

Converting the data source into widgets
Now, after creating data source, it’s important to convert our each item as a widget so that we can use them as a child of our listview.

In the above code, we are using ListView.builder() which expects context and index (position of list item) as a parameter. And we are returning each item as ListTile widget.

Now, after combining all the above code, our main.dart file will have the following code-

Flutter Infinite ListView

ListView with items that can be scrolled infinitely in both directions.

Replace your existing ListView with InfiniteListView. Builder pattern must be used because of its infinite nature.

Run this command:

With Flutter:

 $ flutter pub add infinite_listview

This will add a line like this to your package’s pubspec.yaml (and run an implicit flutter pub get):

  infinite_listview: ^1.1.0

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

This is the end of our Flutter ListView Long List tutorial article. If you want to add a custom icon or custom font to the project read our other tutorials.

How to add a ListView to a Column in Flutter?

    children: <Widget>[
      Text('Leading text widget'),
        shrinkWrap: true,
        physics: NeverScrollableScrollPhysics(),
        children: <Widget>[
            leading: Icon(Icons.map),
            title: Text('Map'),
            leading: Icon(Icons.photo_album),
            title: Text('Album'),
            leading: Icon(Icons.phone),
            title: Text('Phone'),
      Text('More widget'),

Add this two line of code

shrinkWrap: true,

physics: NeverScrollableScrollPhysics(),

In ListView.Builder you can wrap the listview widget with Expanded widget or Flexible widget and limit the itemCount value.

Horizontal ListView inside a Vertical ScrollView in Flutter

body: SingleChildScrollView(
  child: Column(
    mainAxisSize: MainAxisSize.min,
    children: <Widget>[
        style: TextStyle(fontSize: 18),
        height: 200.0,
        child: ListView.builder(
          physics: ClampingScrollPhysics(),
          shrinkWrap: true,
          scrollDirection: Axis.horizontal,
          itemCount: 15,
          itemBuilder: (BuildContext context, int index) => Card(
                child: Center(child: Text('Dummy Card Text')),
        'Demo Headline 2',
        style: TextStyle(fontSize: 18),
        child: ListTile(title: Text('Motivation $int'), subtitle: Text('this is a description of the motivation')),
        child: ListTile(title: Text('Motivation $int'), subtitle: Text('this is a description of the motivation')),
        child: ListTile(title: Text('Motivation $int'), subtitle: Text('this is a description of the motivation')),
        child: ListTile(title: Text('Motivation $int'), subtitle: Text('this is a description of the motivation')),
        child: ListTile(title: Text('Motivation $int'), subtitle: Text('this is a description of the motivation')),

Happy Coding! 🙂

Top 10 Most Important Flutter Widgets Tutorial You Definitely Learn

Flutter provides lots of widgets to build an app. in fact, Flutter is all about widgets that are combined to build a full-fledged dynamic app.

Today, In this blog post, we are going to see about the top 10 flutter widgets.

that every flutter developer should know and which will be a lifesaver for them.

So, Let’s start!

Top 10 Flutter Widgets

1. Align Widget

Align widget is used when we want our child widget to be aligned at different positions (places) within our parent widget.

  child: Container(
    height: 120.0,
    width: 120.0,
    color: Colors.blue[50],
    child: Align(
      alignment: Alignment.topRight,
      child: Text(
        "Aligned Text",

2. SafeArea Widget

SafreArea widget provides sufficient padding to its child widget to avoid intrusions with the status bar at the top of the screen.

There are a lot of scenarios when we build our user interface without the AppBar, but the problem is the Container will shift up over the status bar of the screen which we don’t want to be. This is where this flutter widget comes in handy.

          child: Container(
            color: Colors.purple[200],
            child: Align(
              alignment: Alignment.topCenter,
              child: Text(
                "With SafeArea",
                style: TextStyle(fontSize: 20.0),

3. SizedBox Widget

A SizedBox widget is basically a box widget with a specified height and width. This widget is handy when we want any of the widgets to be of a specified size.

We can provide height and width as a named argument to this widget.

which will then resize its child widget to its specified size.

              child: SizedBox(
                height: 50.0,
                width: 100.0,
                child: RaisedButton(
                  color: Colors.red,
                  child: Text('Click Me'),
                  onPressed: () {},
Hint: We can also set the width value to double.infinity, to make the button width to full width of the container!

4. Expanded Widget

An expanded widget is necessary when we want the child widgets of a row or a column or a flex to fill all the available spaces along the main axis.

An expanded widget must be a descendant of flutter widgets like row or column or flex.

            child: Column(
              children: <Widget>[
                  color: Colors.red,
                  height: 100,
                  child: Container(
                    color: Colors.blue,
                  color: Colors.green,
                  height: 100,

5. Wrap Widget

A wrap widget is used to display its multiple child widgets into multiple horizontal or vertical runs.

Basically, when we try to put widgets in a row or column, we will run out of space on the screen and flutter will show errors.

Thankfully, with the help of this widget, the child widget which doesn’t fit in the space will wrap to the next parallel run.

              children: <Widget>[
                  margin: EdgeInsets.all(8.0),
                  child: RaisedButton(
                    onPressed: () {},
                    child: Text("Button 1"),
                    color: Colors.purple,
                  margin: EdgeInsets.all(8.0),
                  child: RaisedButton(
                    onPressed: () {},
                    child: Text("Button 2"),
                    color: Colors.purple,
                  margin: EdgeInsets.all(8.0),
                  child: RaisedButton(
                    onPressed: () {},
                    child: Text("Button 3"),
                    color: Colors.purple,
                  margin: EdgeInsets.all(8.0),
                  child: RaisedButton(
                    onPressed: () {},
                    child: Text("Button 4"),
                    color: Colors.purple,

6. FutureBuilder Widget

FutureBuilder widget is important when we are processing something in our app which will take a longer time, and we don’t want our app to freeze until the particular process is completed.

Let’s say, we have an app that will fetch some data from the internet. So, the process will take lots of time to establish the connection, make a request, process it, and get the response. This will consume more time meanwhile, we want to show some spinner or loading text until we have data to show.

In such conditions, this widget will do all the heavy lifting in the background and will provide us data when it is ready avoiding stopping the normal workflow of the app. Technically, it returns Future Object which is not known prior.

  Widget build(BuildContext context) {
    var futureBuilder = new FutureBuilder(
      future: _getData(),
      builder: (BuildContext context, AsyncSnapshot snapshot) {
        switch (snapshot.connectionState) {
          case ConnectionState.none:
          case ConnectionState.waiting:
            return new Text('loading...');
            if (snapshot.hasError)
              return new Text('Error: ${snapshot.error}');
              return createListView(context, snapshot);

In the above code, FutureBuilder will try to fetch data from the internet, meanwhile, it will show the loading text until the data is available!

7. RichText Widget

RichText widget is a text formatting widget that provides more control over formatting than a normal Text widget. We can pass TextSpan as a child widget which will allow us to format the word or part of it with multiple styling.

              text: TextSpan(
                text: "Coding",
                style: TextStyle(
                  fontWeight: FontWeight.w700,
                  color: Colors.blue,
                  fontSize: 30.0,
                children: [
                    text: "Ninja",
                    style: TextStyle(
                      fontStyle: FontStyle.italic,
                      color: Colors.purple,
                      fontSize: 30.0,

8. MediaQuery Widget

MediaQuery widget provides the current information about the device. For example, It will let us know about screen height and width, its screen orientation, and a lot more about it at a particular instance of time.

This widget acts more or less like Cascading Style Sheets (CSS) media queries in web development.

  Widget build(BuildContext context) {
    MedaiQueryData deviceInfo = MediaQuery.of(context);
    print('size: ${deviceInfo.size}');
    print('padding: ${deviceInfo.padding}');
    return Scaffold(
        appBar: AppBar(
          title: Text('Flutter Demo'),
        body: Center(
            child: Text("Media Query Demo by codingninja.info")

9. ClipRRect Widget

As the name suggests, the ClipRRect widget is used for clipping its child edges with rounded rectangles.

When we want a circular container or a card or an image with rounded corners. this widget is used to clip the edges into rounded rectangle/circular shapes.

              child: ClipRRect(
                borderRadius: BorderRadius.circular(25.0),
                child: Image.asset('assets/image.jpg'),

10. Flexible Widget

Flexible widget is similar to Expanded widget except for the fact that Flexible takes only the needed space, and Expanded takes all available space, respecting the flex factor.

A flexible widget must be a descendant of flutter widgets like row or column or flex.

            child: Column(
              children: <Widget>[
                  flex: 1,
                  child: Container(
                    color: Colors.red,
                  flex: 3,
                  child: Container(
                    color: Colors.blue,
                  flex: 2,
                  child: Container(
                    color: Colors.green,

Read: How to create Navigation Drawer in Flutter?


Besides the above-listed top 10 flutter widgets, there are other flutter widgets. which need to be explored to be a better flutter developer. It’s all my personal opinion, as I have been using all these flutter widgets in my day-to-day projects. What do you think about it? Please let me know about it in the comment section.

Unlimited Flutter Custom Font Easy Tutorial

Flutter Custom Font is used to make the Flutter UI more attractive and user-friendly. Android and iOS offer lots of high-quality system fonts for their native apps. We can also use some other custom fonts in our apps. We may use different types of flutter icons in our app.

In this tutorial, we will be implementing custom google fonts in our flutter app. In order to use custom fonts, we have to follow the following easy steps:

Supported font formats

Flutter supports the following font formats:

  • .ttc
  • .ttf
  • .otf

Flutter does not support .woff and .woff2 fonts for all platforms.

  • Download the required fonts from Google Fonts.
  • Import them into the flutter project.
  • Declare the font in the pubspec.yaml
  • Using the Custom Fonts.

Download the required fonts from Google Fonts

Google fonts provide a wide variety of web fonts that we can use both in web apps and mobile apps. To download fonts, visit Google Font.

Import them into the flutter project

Once we downloaded the fonts zip file. Extract them.

Now let’s create one fonts folder inside our project (not inside the lib) and place all the fonts as shown in the screenshot:

Declare the fonts in the pubspec.yaml

Now, we will declare all the flutter custom fonts into pubspec.yaml file. While adding into the pubspec.yaml, we have to be very careful as this file is space sensitive. Make sure the structure looks exactly the same as in the code below, otherwise we will get error during the sync process.

Using the Flutter Custom Font

Now once we have added it to pubspec.yaml, we are ready to use them in our project. 

We can also use the custom font as our app’s default font by using the following code:

But, we can also use multiple custom fonts in our app. For demonstration purposes, we are using here 3 different fonts with Text widget as below:

Our overall main.dart file will have the following code:

Now, we will achieve as shown in the screenshot below:

You can also see this popular video about how to use flutter custom font in your project

Happy Coding 🙂

Top 6 Best Flutter Icons Package List

Today’s Flutter Talks: When you build an app you may use different types of icons in your app for the UI. For that, you may use some of the best flutter UI packages in your app pubspec file. There are many awesome flutter packages available in the pub.dev. How to add icon in flutter project. add custom icon flutter. Therefore, In this article, we have listed some of the best flutter icons packages.

Flutter is growing its popularity people are using Google Flutter UI Toolkit for their app development.

Top 6 Best Flutter Custom Icons Package List

  1. Flutter Launcher Icon Package.
  2. Material Design Icons Package.
  3. Flutter Icon Package.
  4. The Font Awesome Icon pack.
  5. Flutter package for Typicons.
  6. flutter_icons Package.

1. Launcher Icons Package:

A package that simplifies the task of updating your Flutter app’s launcher icon. This package is one of the best icon package for flutter. This app launcher icon flutter package can be the best choice for you.

Add this to your package’s pubspec.yaml file:

  flutter_launcher_icons: ^0.10.0

2. Material Design Icon Package:

Add this to your package’s pubspec.yaml file:

  material_design_icons_flutter: ^4.0.5755

3. Customizable Flutter Icons:

Collection of Customizable Icon for Flutter, you can use with over 3K+ icon in your flutter project.

Add this to your package’s pubspec.yaml file:

  flutter_icons: ^1.1.0

4. Font Awesome Package:

The Font Awesome Icon pack available as set of Flutter Icons. This is one of the awesome icons flutter packages for your app.

Based on Font Awesome 5.15.1. Includes all free icons:

  • Regular
  • Solid
  • Brands


In the dependencies: section of your pubspec.yaml, add the following line:

  font_awesome_flutter: ^8.10.0

5. Typions Pack:

Typions pack with the code to support flutter, easy use, beautifully.


  typicons_flutter: ^0.4.2

6. flutter_icons:

This package is one of the best flutter packages. Best Customisable Icons for Flutter, Inspired by react-native-vector-icons. you can use over 3K+ icons in your flutter project.


dependencies: flutter_icons: ^1.1.0
Exit mobile version