dispose method

void dispose()

Marks the BuildContext as disposed.

Creators of this object must call dispose when their Element is unmounted, i.e. when State.dispose is called.

Implementation

void dispose() {
  // TODO(polina-c): stop duplicating code across disposables
  // https://github.com/flutter/flutter/issues/137435
  if (kFlutterMemoryAllocationsEnabled) {
    FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
  }
  _state = null;
}