DisposableBuildContext<T extends State<StatefulWidget>> constructor Null safety

DisposableBuildContext<T extends State<StatefulWidget>>(
  1. T _state

Creates an object that provides access to a BuildContext without leaking a State.

Creators must call dispose when the State is disposed.

The State must not be null, and State.mounted must be true.


DisposableBuildContext(T this._state)
    : assert(_state != null),
      assert(_state.mounted, 'A DisposableBuildContext was given a BuildContext for an Element that is not mounted.');