useSetupContext static method

JoltSetupContext<SetupWidget> useSetupContext()

Gets the current JoltSetupContext.

Returns: The JoltSetupContext of the current SetupWidget

Throws: An assertion error if called outside of a SetupWidget

This is typically used internally by other hooks and utilities.

Implementation

@pragma('vm:prefer-inline')
@pragma('wasm:prefer-inline')
@pragma('dart2js:prefer-inline')
static JoltSetupContext useSetupContext() {
  final currentContext = JoltSetupContext.current;
  assert(currentContext != null, 'SetupWidgetElement is not exsits');

  return currentContext!;
}