handleFunction method
void
handleFunction({
- required OnHandleFunctionStateFullWidget<
T> onFunction, - OnHandleErrorStateFullWidget<
T> ? onError,
Implementation
void handleFunction({
required OnHandleFunctionStateFullWidget<T> onFunction,
OnHandleErrorStateFullWidget<T>? onError,
}) {
Future(() async {
try {
await onFunction(context, widget);
} catch (error, stack) {
OnHandleErrorStateFullWidget<T>? eFunction = onError;
if (eFunction != null) {
await eFunction(error, stack, widget);
} else {
rethrow;
}
}
});
}