dart函数节流

1、节流函数单位时间内,只执行一次。

Function tr = throttle((List args){
        print("-----------------------6666");
        int count = args[0];
        int total = args[1];
        double radio = count/total;
        String str = (_progress_val*100).toInt().toString();
        setState(() {
          _progress_val = radio;
          _progress = "下载进度:${str}%";
        });
      }, 500);



tr([count,total]);