Bacancy Bacancy
  • Our Engagement Models

    We offer flexible engagement models tailored to your project scope and timeline.

    Software Development Outsourcing
    Staff Augmentation
    Dedicated Teams
    Engagement Models

    High-Quality, Affordable IT Outsourcing

    Explore All Services

    AI & ML

    • AI Strategy & Roadmap
    • AI Development
    • Generative AI
    • AI Agent Development
    • Machine Learning
    • Computer Vision
    • LLM Development
    • RAG Development

    Data

    • Data Engineering
    • Data Analytics & BI
    • Data Science
    • Data Warehouse
    • Data Lake
    • Data Governance

    Cloud

    • Cloud Consulting
    • Cloud Migration
    • AWS Services
    • Azure Services
    • GCP Services
    • Kubernetes
    • DevOps

    Product Engineering

    • Full Stack Development
    • Custom Software Development
    • SaaS Development
    • App Modernization
    • Mobile App Development
    • Web Development
    • UI/UX Design

    Platforms

    • Salesforce
    • SAP
    • ServiceNow
    • Microsoft Dynamics
    • Snowflake
    • Databricks
  • Why Bacancy

    14+ years building domain-specific products for regulated and high-growth industries worldwide.

    Global delivery, every time zone

    Global delivery, every time zone

    1050+ vetted engineers

    1050+ vetted engineers

    Onboard in 48 hours

    Onboard in 48 hours

    Explore Our Case Studies

    Industries

    • Healthcare
    • Finance
    • eCommerce
    • Logistics
    • Fintech
    • Real Estate
    • Education
    • Insurance
    How Bacancy Built a Custom Epic EHR Solution to Automate Clinical Workflows

    How Bacancy Built a Custom Epic EHR Solution to Automate Clinical Workflows

    Read case study
  • About.

    1050+ world-class tech experts. One standard: customer satisfaction.

    About Company

    About Company

    • About Us
    • Leadership Team
    • Customer Reviews
    • Infrastructure
    • Our Locations
    • Partnership

    Resources

    • Press Room
    • Blog
    • Insights
    ISO/IEC 27001:2022 Certified

    ISO/IEC 27001:2022 Certified

    Built for enterprise security and compliance.

    Get Quote
  • Technologies
  • Customer Stories
  • Contact Us
Find a Developer
book a 30 min call
  • AI Strategy & Roadmap
  • AI Development
  • Generative AI
  • AI Agent Development
  • Machine Learning
  • Computer Vision
  • LLM Development
  • RAG Development
  • Data Engineering
  • Data Analytics & BI
  • Data Science
  • Data Warehouse
  • Data Lake
  • Data Governance
  • Cloud Consulting
  • Cloud Migration
  • AWS Services
  • Azure Services
  • GCP Services
  • Kubernetes
  • DevOps
  • Full Stack Development
  • Custom Software Development
  • SaaS Development
  • App Modernization
  • Mobile App Development
  • Web Development
  • UI/UX Design
  • Salesforce
  • SAP
  • ServiceNow
  • Microsoft Dynamics
  • Snowflake
  • Databricks
  • Healthcare
  • Finance
  • eCommerce
  • Logistics
  • Fintech
  • Real Estate
  • Education
  • Insurance
  • About Us
  • Leadership Team
  • Customer Reviews
  • Infrastructure
  • Our Locations
  • Partnership
  • Press Room
  • Blog
  • Insights

Technologies

Customer Stories

Contact Us

Find a Developer
book a 30 min call
State management in flutter

The Battle Between The States (All About State Management in Flutter & Stateful Widgets, and BLoC Architecture)

Paridhi Wadhwani
Paridhi Wadhwani Tech Geek
Last Updated on February 24, 2026 | Written By: Paridhi Wadhwani

All things you come across in Flutter are Widgets. Like Components/Controllers in Ionic language, Activities in Android, or React Native Components, everything you create on your app screen is a Widget. So, Buttons, Checkbox, Radio, ListView, Drawer, Tabs, Grid, etc. that interact with the visual aspect of your application are widgets.

From this blog’s title, you would have made out that there are two types of Widgets in Flutter:
Stateless & Stateful Widgets.

First, let us understand them:

Stateless Widgets do not have a specific mutable state and are immutable, meaning when the app is in action, the stateless widgets cannot be redrawn. Hence, such Flutter widgets do not have any internal state, and you can modify their state only when they are re-initialized.

Text, Column, Row, Container, etc. are stateless widgets, and you need to pass some parameters while creating these widgets such as dimensions or decorations. The state of such widgets remains the same throughout the application lifetime.

Stateless Widgets

[A bare minimum Stateless Widget]

On the contrary, Stateful Widgets have a mutable state, and you can draw them n number of times within their lifetime. Such widgets are dynamic, and you can modify their state without reinitiation. Learn How To Build First Reusable Widget Using Flutter?

Checkbox, Button, etc. are examples of stateful widgets that generally contain an inner value or data that determines their state. The state of the widget may change as a user selects an item of the checkbox or presses a button.

Stateful Widgets

[A bare minimum Stateful Widget]

You may also like to read;Top Flutter Libraries, Tools, Packages and Plugins

Flutter State Management

The state of a stateful widget can vary at different stages during the app lifetime. On every action, you need to define the state of your stateful widget and reinitiate it. You can execute the same by assigning properties to the setState() method.

setState()

For a stateful widget, whenever you call this function, it triggers the build() function of the widget, which in turn redraws the widget. Ideally, you should call the setState() function under the onChanged property of the widget.

Let us see a sample code where we imply state change for a checkbox:

setState()

[Redrawing widget using setState()]

However, this method of widget redrawing has some drawbacks. Before we get to the issues, you need to understand the widget hierarchy in your flutter application.

Widget Elementary Tree

The following image will describe the scenario well. Your application will be categorized likewise. Now, for example, you want to change the state of a child widget when a parent widget is affected.

Widget Elementary Tree.

[Source: Blogspot]

In such scenarios, you will face the following two major problems:

Issue #1 Parent to Child Rendering

Ideally, when you execute a setState() function on a parent widget, it by-default runs all its child widgets, whether or not they are stateful widgets, or whether or not they are stateful widgets need to be redrawn.

This way, all the child widgets are rendered irrespective of a need to state-change. So, you are unable to render a specific child widget, keeping the rest unchanged.

Issue #2 Child to Child Rendering

Imagine you want to change the state of one child widget when some action occurs on another child widget. Both widgets are in the same class and are rendered by one parent widget. In such a case, you will be unable to render a child widget from another.

Child to Child Rendering

[Source: Medium]

Now, to overcome these barriers of the setState() method, and to enable MVC architecture for your Flutter application, there are some state management techniques.

MobX, Scoped Model, Redux, and BLoC Architecture can help you solve the issue.

However, Scoped Model and Redux again face primary issues relevant to boilerPlate, Scope, and data rendering.

So, let me share the most reliable Flutter state management technique for the stateful widgets of your Flutter state management.

BLoC Architecture for State Management in Flutter

At their Google I/O conference (2018), Paolo Soares and Cong Hui introduced the BLoC architecture pattern for Business Logic Component and applied it to the business logic between various Dart applications.

Applying the BLoC architecture, you can keep the business logic of your application separate from the UI view by using Streams. In this manner, it enables an MVVM architecture for your app.

However, BLoC is a logic and not an architectural theory, so you can choose any suitable architecture for your application and can still implement the BLoC logic for Flutter state management best practices.

BLoC Architecture

[Source: https://www.raywenderlich.com]

For understanding the BLoC architecture and flutter state management best practices, you will first have to know some notions.

Streams yield multiple values that are asynchronous events. Streams are similar to the Future that the dart: async package provides.

You can consider Sink as the end from where you feed data in your application.

StreamController acts like the manager of both Stream and Sink. It coordinates your application functioning by handling the business logic under it.

StreamBuilder is yet another manager that observes StreamController and implements the state change in your app.

Now, let us see how the BLoC architecture in Flutter state management works.

BLoC architecture component

[Source: Medium]

The above diagram depicts a simple flow of execution when a user interacts with your application. When a user clicks a UI component of your application, it sends an event (action) to the BLoC component.

After that, the BLoC component interprets the action and executes the required business logic. It passes the state change of the destination widget that will show the results of his/her action.

Here, to understand the role of InheritedWidget in Flutter state management, you should read ahead.

Inherited Widget

To understand the concept of Inherited Widgets, we will take an example, and for that, you need to consider the following widget-tree structure:

Inherited Widget

[Source: https://www.didierboelens.com]

Suppose Widget A is a button widget (stateful) in our shopping cart example. Widget B is a text box widget (stateful) that changes state every time a user presses Widget A (button). Widget C
is also a text box widget (stateless), but that does not need to change state on button press.

Here I have presented sample code for the above-illustrated shopping cart example.

illustrated shopping cart
presses Widget A

Whenever a user adds an item by clicking on Widget A, the InheritedWidget _MyInherited is recreated.

InheritedWidget _MyInherited

MyInheritedWidget contains a list of Items. The static MyInheritedWidgetState generates the state of the context (BuildContext).

MyInheritedWidgetState

Every time the user adds an item in the cart, the MyInheritedWidgetState rebuilds its state.

MyInheritedWidgetState

This class builds a widget tree whose parent is the MyInheritedWidget class.

MyInheritedWidget class.
widget tree

WidgetA is a RaisedButton component that invokes the addItem method of closest MyInheritedWidget on user-press.

RaisedButton component

The number of items in the shopping cart will be displayed in WidgetB, a simple text component. It takes the updated value of the cart-item from the closest MyInheritedWidget.

closest MyInheritedWidget

In the above sample code, Widget A and Widget B are rebuilt, and Widget C remains unchanged as there is no need for it to rebuild.

Take Away

Google’s Flutter is an amazing language that has proved its wonders. Whether Stateless or Stateful Widgets, whatever type of app you want to create for your users, you would want the best of all Flutter app development company and Flutter state management best practices. At Bacancy, we have expert Flutter masters that can accomplish almost anything that any other language like Kotlin, Swift, or Java can achieve.

Using the Flutter state management best practices, our proficient Hire Flutter app developers can build next-generation Android and iOS apps. Build high-quality, native, and sophisticated interfaces in no time with Flutter.


Expand Your Digital Horizons With Us.

Start a new project or take an existing one to the next level. Get in touch to start small, scale-up, and go Agile.

Your Success Is Guaranteed !

Related Articles

Vaidehee Vala

June 9, 2026

Flutter

Flutter BLoC vs Riverpod vs Provider: State Management Comparison 2026

By : Vaidehee Vala

Flutter state management is how an app stores data, decides which widgets rebuild, and keeps the UI in sync with...

Read More
Vaidehee Vala

April 20, 2026

Flutter

Native vs Cross Platform: Which Mobile Development Fits Your Product Best

By : Vaidehee Vala

Native vs cross platform app development is the most talked-about comparison of two approaches used to build mobile applications. Native...

Read More
Vaidehee Vala

April 3, 2026

Flutter

Dart vs JavaScript: Which Should Mobile Developers Choose in 2026?

By : Vaidehee Vala

Choosing between Dart vs JavaScript can shape how your mobile app performs, scales, and evolves over time. This guide breaks...

Read More
Bacancy Technology

AI-powered enterprise software engineering since 2011.

Trusted by Fortune 500 companies.

4.6 Google Reviews 4.5 Glassdoor Reviews 4.8 Clutch Reviews 4.5 GoodFirms Reviews
ISO/IEC 27001:2022 Information Security Management System
Great Place To Work Get in Touch
Schedule Call

Looking for expert advice?

Schedule a Expert Call
Offices:
New Jersey New Jersey
Canada Toronto
India Ahmedabad
India Pune
India Bengaluru
UK London
Australia Adelaide
Sweden Gothenburg
UAE Dubai
  • About Us
  • Careers
  • Case Studies
  • Use Cases
  • Press Release
  • Blog
  • Insights
  • Contact Us
  • Customer Reviews
  • Privacy
  • Sitemap

© 2026 Bacancy Services Private Limited All Rights Reserved.

  • Facebook
  • Twitter
  • LinkedIn
  • YouTube
  • Instagram
  • Dribbble
  • Behance
  • Pinterest