Exploring Widget lifecycle methods in Flutter

Flutter Widget Lifecycle

Like app lifecycle, widgets in flutter also have lifecycle methods associated with them. In this article, we will take a look at Widget lifecycle methods in flutter.

If you’re looking for Flutter App lifecycle methods, check this article:

Widget Lifecycle Methods

Widgets in Flutter have following lifecycle methods associated with them:

  • initState: This method is called when this object is inserted into the tree. This will be called exactly once per State object. Here we can initialize the variables needed for the widget such as AnimationController.
  • build: This method is called every time the widget is rebuilt. This can be after call to…


Exploring App lifecycle methods with a reusable logic

Flutter App Lifecycle

As with every framework out there, Flutter also has a lifecycle associated with every app. In this article, we will take a look at the different app lifecycle methods available in Flutter.

We will also explore how to observe orientation change in our app. Finally we will see how to reuse the lifecycle logic so that all the lifecycle methods are available across our app. That’s a lot to cover, so let’s get started!

App Lifecycle Methods

Following are the app lifecycle states in Flutter as defined by AppLifecycleState enum:

  • detached: The application is still…


Getting started with the Grid layouts in Flutter with examples

GridView and Staggered GridView in Flutter

In this article, we will take a look at the GridView widget in Flutter, why it is not suitable for all the use cases, and how we can use the Staggered GridView to layout complex items. So let’s get started!

GridView

From the docs, The GridView is a scrollable, 2D array of widgets. It is basically used to lay the items in a tabular grid fashion.

There are the following constructors of the GridView class:


Using lint rules for a clean Flutter code

Dart Linting for your Flutter Codebase

When working in a team, its very important that everyone follows the same coding styles so that it increases the readability of the code. Similar coding styles also makes it easier to maintain the codebase.

In this article, we will see how we can set up lint rules for our Flutter project. First we will go through some of the available packages which provide some rules and also how we can enable lint rules manually which gives us more control on which rules we want to apply. Let’s begin!

The analysis options file

The linting as…


Internationalizing Flutter apps the easy way

When you think of deploying an app across multiple geographic locations, you should internationalize your app to make users feel at home while using it. Flutter now comes with a localization tool which makes it very easy for the developers to incorporate multiple languages in the application.

In this article, we will look at how we can internationalize our Flutter apps in a very simple way. So let’s get started!

Getting Started

Let’s start off by creating a new Flutter project. We will cover the following points in this article:

  • Use two different Locales, English and…


Getting started with Firebase Cloud Functions with an use case

Cloud Functions for Firebase

While developing mobile and web applications, we often require to carry out some backend operations with response to certain events taking place in our application. Let’s say we want to send a welcome message when a new user signs up on our platform. Traditionally this was done using a backend code running on our own server. This process was inefficient in many ways including managing the security, server maintenance and others.

The Cloud Functions for Firebase exactly allows us to achieve this (and much more). From the docs:

Cloud Functions…


Custom Loading Shimmer in Flutter

NOTE: This is my first Medium article, any suggestions would be appreciated! :)

When you open the Zomato app, you might come across the beautiful loading view effect till the time the view loads up. This is achieved by using Shimmer effect, made popular by Facebook.

In this article, I’ll walk you through how you can create a similar custom shimmer effect using a simple Post widget in Flutter.

In this example, we will use this shimmer library. So let’s get started!

Installation

  1. Add the shimmerdependency to your pubspec.yaml file:
dependencies:
shimmer: ^1.1.1

2. Run the following command in the terminal…

Harshvardhan Shinde

SDE at OYO | Flutter ❤️Android | COEP

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store