MessageNotifier class
MessageNotifier is a centralized utility class to display messages in different styles (Snackbar, AlertDialog, Toast).
It supports showing success, warning, error, and fully custom messages, each with default configurations that can be overridden by a custom MessageConfig.
The message display type is controlled by DisplayType and can be one of:
- snackbar
- alert dialog
- toastification
Example usage:
MessageNotifier.showSuccess(
context: context,
title: 'Success',
message: 'Operation completed successfully.',
displayType: DisplayType.snackbar,
);
MessageNotifier é uma classe utilitária centralizada para exibir mensagens em diferentes estilos (Snackbar, AlertDialog, Toast).
Ela suporta exibir mensagens de sucesso, aviso, erro e mensagens totalmente customizadas, cada uma com configurações padrão que podem ser sobrescritas por um MessageConfig personalizado.
O tipo de exibição da mensagem é controlado por DisplayType e pode ser um de:
- snackbar
- diálogo de alerta (alert dialog)
- toastification
Exemplo de uso:
MessageNotifier.showSuccess(
context: context,
title: 'Sucesso',
message: 'Operação concluída com sucesso.',
displayType: DisplayType.snackbar,
);
Constructors
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
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
showCustom(
{required BuildContext context, required String title, required String message, required DisplayType displayType, required MessageConfig config}) → void - Shows a fully custom message with required configuration.
-
showError(
{required BuildContext context, required String title, required String message, required DisplayType displayType, MessageConfig? config}) → void - Shows an error message with default or custom configuration.
-
showSuccess(
{required BuildContext context, required String title, required String message, required DisplayType displayType, MessageConfig? config}) → void - Shows a success message with default or custom configuration.
-
showWarning(
{required BuildContext context, required String title, required String message, required DisplayType displayType, MessageConfig? config}) → void - Shows a warning message with default or custom configuration.