displaySuccess function
Implementation
displaySuccess({
required BuildContext context,
required String message,
int? duration,
}) {
final snackBar = SnackBar(
content: Text(message),
backgroundColor: Colors.green,
duration: Duration(seconds: duration ?? 10),
action: SnackBarAction(
label: 'Close',
textColor: Colors.white,
onPressed: () {},
),
);
// Find the Scaffold in the widget tree and use it to show a SnackBar.
ScaffoldMessenger.of(context).showSnackBar(snackBar);
}