throttle function

dynamic throttle(
  1. Future func()
)

Implementation

throttle(
  Future Function() func,
) {
  bool enable = true;
  Function target = () {
    if (enable == true) {
      enable = false;
      func().then((_) {
        enable = true;
      });
    }
  };
  return target;
}