disposeHooks method

  1. @protected
void disposeHooks()

Disposes all hooks in this HookContext and marks is as unmounted.

Should be called only once, when the HookContext is disposed.

Implementation

@protected
void disposeHooks() {
  assert(() {
    if (!_mounted) {
      throw FlutterError.fromParts([
        ErrorSummary("disposeHooks has been called more than once"),
        ErrorDescription("disposeHooks must be called exactly once"),
        DiagnosticableTreeNode(name: "context", value: this, style: null),
      ]);
    }
    return true;
  }());

  for (final state in _hooks) {
    state.dispose();
  }
  _mounted = false;
}