useContext function Null safety

BuildContext useContext()

Obtain the BuildContext of the building HookWidget.

Implementation

BuildContext useContext() {
  assert(
    HookElement._currentHookElement != null,
    '`useContext` can only be called from the build method of HookWidget',
  );
  return HookElement._currentHookElement!;
}