showSnackBar static method
void
showSnackBar(
- BuildContext context, {
- required String message,
- String? actionText,
- Function? actionCallBack,
Implementation
static void showSnackBar(BuildContext context,
{required String message, String? actionText, Function? actionCallBack}) {
if (!context.mounted) return;
final snackBar = SnackBar(
content: Text(message),
action: actionText != null
? SnackBarAction(
label: actionText,
onPressed: () {
actionCallBack?.call();
},
)
: null,
);
// Find the ScaffoldMessenger in the widget tree
// and use it to show a SnackBar.
ScaffoldMessenger.of(context).showSnackBar(snackBar);
}