Saqlain AppDev

  • Home
  • Saqlain AppDev

Saqlain AppDev Flutter Developer | 5+ Apps Built
Building MVPs for startups. Coding tips & dev journey
๐Ÿ“ฉ DM for projects

Flutter Series: Part  #33Provider: Your First Practical ExampleIn Part 32, we covered what Provider is and why it can be...
17/08/2026

Flutter Series: Part #33
Provider: Your First Practical Example

In Part 32, we covered what Provider is and why it can be useful for managing shared state.

Now it's time to move from concept to implementation.

In this example, we build a simple Counter App using:

๐Ÿ”น ChangeNotifier: Holds and manages the state

๐Ÿ”น ChangeNotifierProvider: Makes the state available to the widget tree

๐Ÿ”น context.watch(): Reads the state and listens for changes

๐Ÿ”น context.read(): Accesses the provider without listening

๐Ÿ”น notifyListeners(): Notifies listening widgets when the state changes

The complete flow:
User Action โ†’ State Change โ†’ notifyListeners() โ†’ UI Rebuild

The counter itself is simple, but the pattern is important.

Instead of keeping state and logic directly inside the UI, Provider allows us to separate them and create a more structured approach to state management.

This same pattern becomes much more useful when working with real-world state such as:

๐Ÿ›’ Shopping carts

๐Ÿ” Authentication

๐ŸŒ API data

๐Ÿ‘ค User profiles

โค๏ธ Favorites

๐Ÿ“Œ Save this post if you're learning Provider in Flutter.

Next, we'll look at an important question:

What's the difference between context.watch(), context.read(), and Consumer

Flutter Series: Part  #32What is Provider in Flutter?As Flutter applications grow, managing shared state across multiple...
15/08/2026

Flutter Series: Part #32
What is Provider in Flutter?

As Flutter applications grow, managing shared state across multiple widgets and screens can become increasingly difficult.

That's where Provider comes in.

Provider is a state management solution that allows application state to be made available to widgets and enables dependent UI to react when that state changes.

In this post, I break down:

๐Ÿ”น Why Provider?
Why manually passing shared data through multiple widget levels can become difficult to maintain.

๐Ÿ”น What is Provider?
How Provider connects application state with the widget tree.

๐Ÿ”น How Provider works
A simple approach to providing state, accessing it, and reacting to changes.

๐Ÿ”น ChangeNotifier
How state changes can notify listeners and trigger updates in dependent UI.

๐Ÿ”น Provider vs setState()
When local state is enough and when a structured shared-state approach becomes useful.

๐Ÿ”น Real-world use cases
Shopping carts, authentication, user profiles, theme settings, API data, and favorites.

The core idea is simple:
Shared State โ†’ Centralized Management โ†’ Controlled Updates โ†’ Reactive UI

Provider isn't something to memorize as just another package.

The important part is understanding the problem it solves and when you actually need it.

๐Ÿ“Œ Save this post if you're learning Flutter state management.

Next, we'll move from the concept to a practical Provider implementation.

Flutter Series: Part  #31What is State Management in Flutter?As Flutter applications grow, managing changing data across...
13/08/2026

Flutter Series: Part #31

What is State Management in Flutter?

As Flutter applications grow, managing changing data across different widgets and screens can become challenging.

That's where State Management comes in.

State is any data that can change while the application is running and affect what the UI displays.

Examples include:

โค๏ธ Like / Unlike
๐Ÿ›’ Shopping Cart
๐Ÿ” Authentication State
๐Ÿ‘ค User Profile
๐ŸŒ API Data
๐ŸŽš๏ธ Filters & Selections

State Management provides a structured way to:

Store โ†’ Update โ†’ Share โ†’ React

It becomes especially important when the same state needs to be accessed or updated by multiple parts of an application.

Another important consideration is UI rebuilding.

When state changes, Flutter may rebuild affected widgets. Frequent or unnecessary rebuilds can increase CPU work, rendering workload, and memory pressure.

The goal isn't to prevent every rebuild.

The goal is to rebuild only what actually needs to change.

In this post, I also break down:

๐Ÿ”น Local vs Shared State
๐Ÿ”น Why State Management is needed
๐Ÿ”น Common approaches like Provider, Riverpod, BLoC/Cubit, and GetX
๐Ÿ”น How state changes flow through an application

The important thing to understand is that State Management isn't simply about choosing a package.

It's about answering:

Where should the state live?
Who should be able to change it?
Which parts of the UI should react to it?

Once these concepts are clear, choosing the right approach becomes much easier.

๐Ÿ“Œ Save this post if you're learning Flutter and moving toward building larger applications.

Flutter Series: Part  # 30Handling API States in FlutterFetching data from an API is only one part of API integration.A ...
11/08/2026

Flutter Series: Part # 30

Handling API States in Flutter

Fetching data from an API is only one part of API integration.

A production-ready application also needs to handle what happens before, during, and after the request.

In this post, I cover the four essential API states:

โณ Loading
The application is waiting for the API response.

โœ… Success
The request succeeds and data is available to display.

โŒ Error
The request fails due to network issues, server errors, or other problems.

๐Ÿ“ญ Empty
The request succeeds, but there is no data to display.

A good API-driven UI should communicate each of these states clearly instead of leaving users with a blank screen or an unclear error.

The mindset should be:

Don't just ask :"Did the API return data?"

Ask:

"What should the user see in every possible state?"

This brings my API integration series to an important milestone:

API โ†’ JSON โ†’ REST โ†’ Postman โ†’ Models โ†’ GET โ†’ POST โ†’ Parsing โ†’ UI โ†’ State Handling

Understanding the complete flow is much more valuable than simply memorizing individual API methods.

๐Ÿ“Œ Save this post if you're building Flutter applications with REST APIs.

What API state do you think developers most often forget to handle?

Flutter Series: Part  #29POST Requests in Flutter | Sending Data to an APIIn the previous part, we fetched data from an ...
10/08/2026

Flutter Series: Part #29
POST Requests in Flutter | Sending Data to an API

In the previous part, we fetched data from an API using a GET request.
But real-world applications don't just retrieve data.

They also need to send data to the server like creating users, placing orders, submitting forms, sending messages, and much more.

That's where POST requests come in.

In this practical example, I use JSONPlaceholder to demonstrate the complete POST workflow:

1. Test the POST request in Postman
First, we verify the endpoint, request method, JSON body, headers, and response.

2. Prepare the request body
We create the data that needs to be sent to the API.

3. Convert the Dart object using toJson()
Our Dart object is converted into a Map.

4. Encode the data using jsonEncode()
The Map is converted into a JSON string that can be sent in the request body.

5. Send the request using http.post()
Flutter sends the JSON data to the API.

6. Handle the response
We check the status code and process the response returned by the server.

The complete flow:
Dart Object โ†’ toJson() โ†’ Map โ†’ jsonEncode() โ†’ JSON โ†’ http.post() โ†’ API โ†’ Response

The goal isn't just to memorize http.post().

It's to understand how data travels from your Flutter application to the server and back again.

This is the same fundamental workflow you'll encounter when working with real-world APIs.

๐Ÿ“Œ Save this post if you're learning Flutter API integration.

Flutter Series: Part  # 28Complete API Integration in FlutterKnowing what an API is and knowing how to actually integrat...
08/08/2026

Flutter Series: Part # 28

Complete API Integration in Flutter

Knowing what an API is and knowing how to actually integrate one are two different things.

So instead of breaking API integration into several small theoretical posts, I decided to walk through the complete process using a practical example with JSONPlaceholder.

Here's the workflow:

๐Ÿ“ฎ 1. Test the API in Postman

Before writing Flutter code, we verify the endpoint, HTTP method, status code, and response structure.

๐Ÿ“„ 2. Inspect the JSON Response

We understand exactly what data the API is returning and which fields we'll need.

๐Ÿ› ๏ธ 3. Generate the Dart Model

The JSON response is converted into a Dart model so we can work with clean objects instead of raw JSON.

๐Ÿ“ฆ 4. Connect Flutter to the API

Using the http package, we send a GET request and receive the response.

๐Ÿ”„ 5. Parse the Response

jsonDecode() converts the response into Dart data, and User.fromJson() converts each item into a proper model object.

๐Ÿ“ฑ 6. Display the Data

Finally, FutureBuilder handles the asynchronous operation and the users are displayed in the Flutter UI.

The complete flow:

Test โ†’ Inspect โ†’ Model โ†’ Fetch โ†’ Parse โ†’ Display

The goal isn't to memorize every line of code.

It's to understand how each step connects to the next.

Once this workflow becomes clear, integrating other REST APIs becomes much easier because the API may change, the data may change, and the UI may change but the fundamental process remains almost the same.

๐Ÿ“Œ Save this post if you're learning Flutter API integration.

Next, we'll move further into handling real-world API scenarios.

Building an app isn't just about writing code.Before integrating an API, developers first test it using Postman.In this ...
06/08/2026

Building an app isn't just about writing code.

Before integrating an API, developers first test it using Postman.

In this post, you'll learn:

โœ… What Postman is
โœ… Why developers use it
โœ… Testing GET, POST, PUT & DELETE requests
โœ… Viewing JSON responses
โœ… Understanding status codes before integration

Mastering Postman will save you time, reduce debugging, and make API integration much easier.

๐Ÿ“Œ Save this post and follow along.......next we'll use a real API (JSONPlaceholder) and integrate it step by step in Flutter.

Flutter Series: Part  # 27Every API response begins as JSON.But Flutter applications don't work directly with raw JSON, ...
03/08/2026

Flutter Series: Part # 27
Every API response begins as JSON.
But Flutter applications don't work directly with raw JSON, they work with Dart objects.

That's where Model Classes come in.

Instead of accessing values using string keys throughout your application, model classes transform structured JSON into meaningful Dart objects, making your code cleaner, safer, and easier to maintain.

In this post, I explain:
๐Ÿ”น Why Model Classes are important
๐Ÿ”น Creating a Dart model from JSON
๐Ÿ”น Understanding the factory constructor and fromJson()
๐Ÿ”น Converting API responses into Dart objects
๐Ÿ”น Why production Flutter applications rely on models instead of raw JSON

As your application grows, using model classes improves readability, reduces errors, and makes your codebase much easier to scale.

This is Part #27 of Flutter series.

In the next part, we'll complete the cycle by learning how to convert Dart objects back into JSON using toJson().

Do you create model classes manually, or do you prefer using code generation tools like json_serializable or Quicktype?

Flutter Series: Part  # 26One of the biggest milestones in learning Flutter is making your first API request.But receivi...
31/07/2026

Flutter Series: Part # 26

One of the biggest milestones in learning Flutter is making your first API request.

But receiving data from an API is only the beginning.

The server usually sends data in JSON format, a structured text format that Flutter can't directly use to build the user interface.

This is where JSON Parsing comes in.

JSON Parsing is the process of converting a JSON response into Dart objects, allowing your application to access, process, and display data efficiently.

In this post, I cover:

๐Ÿ”น Why JSON parsing is necessary

๐Ÿ”น How jsonDecode() works

๐Ÿ”น Converting JSON into Dart Map and List objects

๐Ÿ”น Accessing data using keys

๐Ÿ”น The complete flow from an API response to the Flutter UI

Understanding JSON Parsing is a fundamental skill for every Flutter developer because almost every real-world application relies on APIs to fetch dynamic data.

This is Part #26 of my Flutter learning series. In the next post, we'll take this a step further by creating Dart Model Classes (fromJson & toJson) to write cleaner, scalable, and production-ready code.

Do you prefer working directly with jsonDecode(), or do you usually create model classes for your API responses?

An API request is only the beginning.The real magic happens when your application receives a response from the server.In...
29/07/2026

An API request is only the beginning.

The real magic happens when your application receives a response from the server.

In this post, you'll learn:

โœ… What an API Response is
โœ… Understanding Status Codes
โœ… What a Response Body contains
โœ… How Flutter uses API responses to display data

Every Flutter developer should understand API responses before moving on to JSON parsing and real-world API integration.

๐Ÿ“Œ Save this post for future reference and follow the series as we continue building real-world Flutter applications.

Address

Street No 2, Allama Iqbal Colony, Jinnah Road

52250

Alerts

Be the first to know and let us send you an email when Saqlain AppDev posts news and promotions. Your email address will not be used for any other purpose, and you can unsubscribe at any time.

Contact The Business

Send a message to Saqlain AppDev:

Shortcuts

Share