Tag Archives: State Management

Flutter Best Practices — Part 2

By | October 17, 2022

1. Avoid Functional Widgets We usually have a situation where we need to separate out UI code from the widget, But we avoid creating a separate widget and use function which returns Widget. This practice have some benefits, like you don’t need to pass all parameters in your new widget, You have less code and less files.… Read More »

Flutter Best Practices — Part 1

By | October 13, 2022

1. Placeholder Widgets Use SizedBox instead of Container as Placeholder widgets. Take a look at the below use-case return _loaded ? Container() : YourWidget(); The SizedBox is a const constructor and creates a fixed-size box. The width and height parameters can be null to indicate that the size of the box should not be constrained in the corresponding dimension.… Read More »

Theming your App in Flutter using BLoc, Save & Reload

By | December 6, 2020

In this article, we will see how we can use BLoc to Theme your app in Flutter. To understand BLoC with a real world example, you can refer to my previous post on BLoC here. Part 1 Part 1 For this demo also we will need the below plugins If you follow my previous tutorial,… Read More »

BLOC Pattern in Flutter explained with Real Example

By | October 5, 2020

In this article we will learn BLoc pattern in flutter for State Management with a simple real world example. Watch Video Tutorial For this example, we will try to consume a web service. The service we are going to use is https://jsonplaceholder.typicode.com/albums What BLoc does? BLoc helps to separate you presentation and business logic. So… Read More »

Easy StateManagement in Flutter using Providers, MultiProviders, ChangeNotifiers and Consumers

By | March 15, 2020

With Providers and MultiProviders we can do easy StateManagement in Flutter. State Management in Flutter Watch Video Tutorial Add Dependencies First Go to your pubspec.yaml file add the below dependency, I would recommend to add the latest dependency version, at this moment it is 4.0.4 provider: ^4.0.4 The Providers will have  Change Notifiers Consumers The Basic… Read More »