useContext function
Gets the current BuildContext from the SetupWidget.
This can only be called within the SetupWidget.setup function or within hooks that are called from setup.
Example:
@override
setup(context, props) {
final context = useContext();
final theme = Theme.of(context);
return () => Container(color: theme.primaryColor);
}
Implementation
BuildContext useContext() {
final currentContext = JoltSetupContext.current?.context;
assert(currentContext != null, 'SetupWidgetElement is not exsits');
return currentContext!;
}