useContext function

BuildContext useContext()

Returns the BuildContext of the currently building hook component.

Implementation

BuildContext useContext() {
  final element = _HookElement._currentHookElement;
  if (element == null) {
    throw StateError('useContext() can only be called while a hook component is building.');
  }
  return element;
}