How to create Toast in Flutter?

1) To show the Toast messages in Flutter we can use  Snackbar widget.

To show snackbar we need to use scaffoldWidget.

Scaffold.of(context).showSnackBar(
      SnackBar(content: Text('This is Snackbar toast'))
);

 

 

2) By Using Flutter fluttertoast 3.1.3 plugin aslo we canshow the Toast Messages.

Fluttertoast.showToast(
        msg: "This is Plugin Toast Message",
        toastLength: Toast.LENGTH_SHORT,
        gravity: ToastGravity.CENTER,
        backgroundColor: Colors.red,
        textColor: Colors.white,
        fontSize: 16.0
    );

 


Subscribe For Daily Updates

Flutter Questions
Android Questions