StateHolder class Null safety


StateHolder is A wrapper around InheritedWidget to make them easier to use and more reusable.

By using StateHolder instead of manually writing InheritedWidget, you get:

  • simplified allocation of resources
  • lazy-loading
  • a vastly reduced boilerplate over making a new class every time
  • friendly to devtools
  • increased scalability for classes with a listening mechanism that grows exponentially in complexity (such as ChangeNotifier, which is O(N) for dispatching notifications).


hashCode int
The hash code for this object.
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
toString() String
A string representation of this object.


operator ==(Object other) bool
The equality operator.

Static Methods

of<T>(BuildContext context, [bool listen = false]) → T
Use This Method To Obtain The Nearest StateHolder