show static method

dynamic show(
  1. String msg, {
  2. Toast? toastLength,
  3. int timeInSecForIos = 1,
  4. double fontSize = 16.0,
  5. ToastGravity gravity = ToastGravity.CENTER,
  6. dynamic duration = 1,
})

Implementation

static show(
  String msg, {
  Toast? toastLength,
  int timeInSecForIos = 1,
  double fontSize = 16.0,
  ToastGravity gravity: ToastGravity.CENTER,
  duration = 1,
}) {
  if (!canShow && oldMsg == msg || !msg.isNotEmpty) return;
  canShow = false;
  oldMsg = msg;
  Fluttertoast.showToast(
          msg: msg,
          gravity: ToastGravity.CENTER,
          timeInSecForIosWeb: duration)
      .then((e) {
    Future.delayed(Duration(seconds: duration), () {
      canShow = true;
    });
  });
}