prepareFormatExceptionFunction method
bool Function(FormatException exception)?
prepareFormatExceptionFunction({
- ExceptionExplanationModel? exceptionExplanationModel,
- BuildContext? context,
Prepares a FormatException handling function based on the provided context and exception model.
exceptionExplanationModel
contains information about the exception for displaying in the alert dialog.context
is the current build context.generalFunction
is a function to handle exceptions when a specific function is not provided, andcontext
is null. It is only invoked in this case.
Returns a function to handle the FormatException.
Implementation
bool Function(FormatException exception)? prepareFormatExceptionFunction({
ExceptionExplanationModel? exceptionExplanationModel,
BuildContext? context,
}) {
if (context == null) {
return (FormatException exception) {
debugPrint(exception.toString());
return true;
};
}
return (FormatException exception) => showAlertDialog(
context,
"FormatException Error",
"An FormatException error occurred.",
"Close",
);
}