在Dart
中有没有办法像这样限制函数执行
Observable.throttle(myFunction,2000);
使用https://pub.dartlang.org/documentation/rxdart/latest/rx/Observable/throttle.html
所以,你在Dart 2中使用RxDart的例子是
final subject = new ReplaySubject<int>();
myCaller(Event event) {
subject.add(event);
}
subject
.throttle(Duration(seconds: 2))
.listen(myHandler);