cancelThrottle static method

void cancelThrottle(
  1. String key, {
  2. Duration duration = const Duration(milliseconds: 300),
})

取消指定 key 的节流窗口

  • key 需要与 throttle(..., key: ...) 的 key 一致
  • duration 需要与创建时一致(因为内部会把 duration 也纳入 key 计算)

Implementation

static void cancelThrottle(
  String key, {
  Duration duration = const Duration(milliseconds: 300),
}) {
  final throttleKey = key.hashCode ^ duration.inMilliseconds;
  _throttleTimes.remove(throttleKey);
}