DisposableBuildContext<T extends State<StatefulWidget>> class

Provides non-leaking access to a BuildContext.

A BuildContext is only valid if it is pointing to an active Element. Once the Element.dispose method is called, the BuildContext should not be accessed further. This class makes it possible for a StatefulWidget to share its build context safely with other objects.

Creators of this object must guarantee the following:

  1. They create this object at or after State.initState but before State.dispose. In particular, do not attempt to create this from the constructor of a state.
  2. They call dispose from State.dispose.

This object will not hold on to the State after disposal.

  • @optionalTypeArgs


DisposableBuildContext(T _state)
Creates an object that provides access to a BuildContext without leaking a State. [...]


context BuildContext
Provides safe access to the build context. [...]
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


dispose() → void
Marks the BuildContext as disposed. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toString() String
Returns a string representation of this object.


operator ==(dynamic other) bool
The equality operator. [...]