showSnackBar method

dynamic showSnackBar(
  1. String message
)

Implementation

showSnackBar(String message) {
  if (!mounted) return;
  final snackBar = SnackBar(
    behavior: SnackBarBehavior.floating,
    width: 400.0,
    content: Text(message),
    action: SnackBarAction(
      label: 'Close',
      onPressed: () {
        ScaffoldMessenger.of(this).hideCurrentSnackBar();
      },
    ),
  );
  ScaffoldMessenger.of(this).hideCurrentSnackBar();
  ScaffoldMessenger.of(this).showSnackBar(snackBar);
}