showToast static method

void showToast(
  1. String message, {
  2. double fontSize = 16.0,
})

Displays a toast message with the given message.

On web, this currently does nothing.

fontSize determines the size of the toast text (default is 16.0).

Example:

ToastUtils.showToast("Hello World", fontSize: 18.0);

Implementation

static void showToast(String message, {double fontSize = 16.0}) {
  if (kIsWeb) {
    // No toast support for web yet
  } else {
    Fluttertoast.showToast(
      msg: message,
      toastLength: Toast.LENGTH_SHORT,
      gravity: ToastGravity.CENTER,
      timeInSecForIosWeb: 1,
      backgroundColor: Colors.grey,
      textColor: Colors.white,
      fontSize: fontSize,
    );
  }
}