CommonUtil class

A utility class containing common helper methods for the application.

Constructors

CommonUtil()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

confirm(BuildContext context, String title, String message, dynamic onConfirm()?, dynamic onDeny()?) Future<void>
Displays a confirmation dialog with "Yes" and "No" options.
convertImage(String base64Image) Uint8List?
Converts a base64 encoded string to a Uint8List.
customError(BuildContext context, String title, dynamic message) Future<void>
Displays a custom error dialog.
defineWidthModalSize(BuildContext context) double
Calculates the proportional width for a modal dialog based on screen size.
error(BuildContext context, String errorMessage, Exception error, {dynamic onReportError(String)?}) Future<void>
Displays a standardized error dialog.
errorException(BuildContext context, dynamic error, {bool realyError = true}) Future<void>
Displays an error dialog from a generic Exception.
formatDecimal(dynamic value) String
Formats a dynamic value as a decimal string with two decimal places.
formatDecimalPattern(dynamic value, String pattern) String
Formats a dynamic value using a custom decimal pattern.
formatMoney(dynamic value) String
Formats a dynamic value as a currency string in Brazilian Real (BRL).
info(BuildContext context, String message) Future<void>
Displays a standardized info dialog.
loading(BuildContext context, String title, String message, Function funcBackground) Future<void>
Displays a loading dialog while a background function is executed.
modernError(BuildContext context, String errorMessage, {String? longMessage, dynamic onReportError(String)?}) Future<void>
Displays a modern, enhanced error dialog.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
showAlert(BuildContext _context, String _title, List<Widget> _body, List<Widget> _actions) Future<void>
Displays a standard AlertDialog.
showCustomDialog(BuildContext context, Widget alertDialog) Future<void>
Displays a custom dialog widget.
success(BuildContext context, String title, {String? message}) Future<void>
Displays a standardized success dialog.
toastError(String message, BuildContext context) → void
Shows an error toast message.
toastInfo(String message, BuildContext context) → void
Shows an informational toast message.
toastSuccess(String message, BuildContext context) → void
Shows a success toast message.
toastWarning(String message, BuildContext context) → void
Shows a warning toast message.
toString() String
A string representation of this object.
inherited
warning(BuildContext context, String message) Future<void>
Displays a standardized warning dialog.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

isDebug() bool
Checks if the application is running in debug mode.
parseDouble(dynamic val) double
Parses a dynamic value to a double.