showToast static method

void showToast(
  1. String? message, {
  2. Toast? toastLength,
  3. required Color? bgColor,
})

showToast Show toast message with message

  • Param message Message to show
  • Param toastLength Length of toast
  • Param bgColor Background color of toast

Implementation

static void showToast(String? message,
    {Toast? toastLength, required Color? bgColor}) {
  Fluttertoast.cancel();
  Fluttertoast.showToast(
      msg: message ?? '',
      textColor: Colors.white,
      backgroundColor: bgColor,
      gravity: ToastGravity.BOTTOM,
      toastLength: toastLength ?? Toast.LENGTH_SHORT);
}