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 is unmounted, 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.

Annotations

Constructors

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

Properties

context BuildContext?
Provides safe access to the build context.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
Marks the BuildContext as disposed.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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