showDialogIfError static method
void
showDialogIfError(
- BuildContext context,
- CustomError customError,
- String title,
- String? message,
- List<
Widget> ? actions,
Shows a dialog if an error exists in the customError
object.
This method displays an NAlertDialog with the provided title
, message
,
and actions
when an error is detected in the customError
object.
If message
is not provided, it uses the error message from customError
.
Implementation
static void showDialogIfError(BuildContext context, CustomError customError,
String title, String? message, List<Widget>? actions) {
String dialogMsg = message ?? customError.getError();
if (customError.hasAnError()) {
showDialog(
context: context,
builder: (BuildContext context) {
return NAlertDialog(
dialogStyle: DialogStyle(titleDivider: true),
title: Text(title),
content: Text(dialogMsg),
actions: actions,
);
},
);
}
}