What is state restoration? Learn how to use it in Flutter to restore scrolled pages and textfield when application is killed by OS

Hello 2021! We all are somehow struggling to restore our lives from the pandemic, most of the activities of our lives have been sort-of in the background, and waiting to come back in some time [some of them obviously got killed by our life’s operating system].

So to begin this year, let’s learn something related to state restoration in general and how to implement it in Flutter. We will learn the following in this article:

  • What is state restoration?

What is state restoration?

You must have…


A post-league synopsis on how to conduct an online Quiz Competition

Correct answers + Fastest fingers first = Flutter Box 📦

2020 has been tough, and people have been staying home for months now. Amidst this pandemic, we continued to carry out out community events through the platform of Flutter Karachi, Pakistan; and it has been amazing to learn a lot of novel things during this time. During the time of Flutter Day community events, we came up with the idea of hosting an online quiz competition which was followed by a complete separate Quiz League which was one of its own kind, the winners of which were shipped a Flutter Box. …


For beginners who want to get half a step ahead in their Flutter learning journeys

Rather than writing setState every time you need to change UI, a cleaner way can be to use notifiers and listeners to let the UI change itself.

In this article we will look at the basic counter example and try to convert it to a cleaner version without using any external libraries or packages.

When you create a new Flutter application you get the following code

class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;

@override
_MyHomePageState createState() => _MyHomePageState();
}

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

void…


A simple collection of 8 common places where you would want to put lists in Flutter. Contributions and suggestions are welcomed!

1. Normal list view


Dragon curve fractal in Flutter using custom painter (inspired by a java code and converted to dart)

This short article gives you some code and loops to create the mathematical Dragon Curve fractal using only canvas.drawLine() function inside dart:ui class!

Ever wonder? If painted in a progression, what wonders a single line can do!

The algorithm is simply recursive, telling each iteration to add the previous one into it and rotate itself 90 degrees every time.

This is the simple code with a loop (inspired by a java code for the same fractal) which does the main work of painting the lines recursively with rotated iterations.

double angle = startingAngle;
int x1 = xStart, y1 = yStart;
int x2 = x1 + (cos(angle) * side).toInt();
int y2 = y1 + (sin(angle) * side).toInt();
var p1…


Neatly componentize your Flutter app using custom widgets & callbacks

As a beginner, you must have wondered how an onTap function works on a ListTile. Or questions like “What if I want to invoke a function, defined in my parent widget, from within a child widget?” must have crossed your mind. Here in this very short article we will understand how to create callbacks in our custom widgets in Flutter.

The parent should know what the child instruments

Let’s first create a custom widget and call it in our main code like this:

class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);

final String title;

@override
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends…


All code is guilty until proven innocent

Errors reveal the character of a code — Anonymous

Today we will see how we can efficiently make API calls in Flutter using Test-Driven Approach. We will be using a sample user API publicly available at JSON placeholder.

IMPORTANT: If you want to know the approach, you will have to follow things from the beginning to the end. Jumping at the end and copying the code will make no difference because it is simply 4 lines of an API call. The actual essence lies in the understanding of TDD Philosophy.

So without wasting your time and my words, we jump to creating a new test file under the test…


Flutter is open to everything, so why not use a hybrid approach to architecture and manage your application!

This article will show you how to build a complete end-to-end Flutter application using MVC and Provider. I have built a COVID-19 statistics application (because you know dash-boarding reveals a lot of valuable results!)

This is what we are trying to build

We will be using MVC to architect our app for decoupling the UI, the model classes, the controller class and the network layer. We will be using the following packages:

Provider will be used to inject Theme — dark mode of course :D

This application uses publicly available APIs for COVID-19, hosted by Javier Aviles. …


GDE — the psychology of ultimate altruism

Image by NUST Community Services Club News — text written by me.

The following passage is a brief summary of the philosophy behind Google Developer Experts Program (according to my personal experience). You will clinch through the following as you progress in this article

  • What is Google Developer Experts Program

What is Google Developer Experts Program

According to the official website:

“The Google Developers Experts program is a global network of highly experienced technology experts, influencers and thought leaders who actively support developers, companies and tech communities by speaking…


Github just launched there mobile application, and their iOS application had a feature of changing app icon from a list of icons given inside the application. I thought people should be able to do that through Flutter code as well =)

For this, I decided to write a very small plugin that let’s you send the name of the app icon to the plugin and it does all the work inside by itself! =]

The plugin is called app_icon_changer

PS: This package doesn’t support Android implementation and only supports iOS 10.3 and above. There are multiple hacks available for changing android app icons but none of them is officially supported by Android

Briefly, these are the few steps you need to perform in order to be able to consume the plugin successfully.

  • Navigate to iOS folder in your Flutter app.

Waleed Arshad

You probably know me.

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