Flutter Toast Package

Flutter Toast Widget provides simple feedback about an operation in a small popup. It only fills the amount of space required for the message and the current activity remains visible and interactive. Toasts automatically disappear after a timeout.

To add Toast Package just write this in your pubspec.yaml file:

fluttertoast: ^4.0.0

To show Toast here is the basic Syntax :

Fluttertoast.showToast(msg: "Sending message...");

You can see the output of this line is :

It has some more properties to customise Toast like textColor, fontSize etc

        msg: "Sending message...",
        toastLength: Toast.LENGTH_SHORT,
        gravity: ToastGravity.CENTER,
        timeInSecForIosWeb: 1,
        backgroundColor: Colors.red,
        textColor: Colors.white,
        fontSize: 16.0

Here is the property Description :

  • msg: to show message
  • toastLength: Toast.LENGTH_SHORT or Toast.LENGTH_LONG
  • gravity: set Gravity like Center, Top, Bottom
  • backgroundColor: change Background Color of Toast
  • textColor: change Text Color of Toast
  • fontSize: fontSize of Flutter Toast Text

You can visit the official website of this Package : Flutter Toast


You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *