Raveesh Agarwal
1 min readSep 26, 2018

--

You don’t really need to use a BLoC Provider Pattern.

Use Dart’s Global Scope to make a singleton and simply import the BLoC in all your widgets that depend on it. RxDart’s BehaviorSubject takes care of init and caching for you.

Even if you decide to go with the BLoC Provider Pattern, You don’t really need an InheritedWidget if you won’t be changing the BLoC on the Fly. All you need is a static of(BuildContext context) method that allows you to access the variable by traversing the tree

Don’t use InheritedWidget to provide a singleton, they are used to update something when the state changes.

--

--

Raveesh Agarwal
Raveesh Agarwal

Written by Raveesh Agarwal

Entrepreneur, software craftsman and technology enthusiast, I continue to solve problems and grow with my projects, partnerships and endeavors.

Responses (2)