multiThrottle static method

dynamic multiThrottle(
  1. Function func,
  2. int milliseconds
)

Implementation

static multiThrottle(Function func, int milliseconds) {
  bool enable = true;
  return (val1, val2) {
    if (enable == true) {
      enable = false;
      Future.delayed(Duration(milliseconds: milliseconds), () {
        enable = true;
        func(val1, val2);
      });
    }
  };
}