Line data Source code
1 : import 'dart:async'; 2 : 3 : class Debouncer { 4 : final Duration delay; 5 : Timer _timer; 6 : 7 1 : Debouncer({this.delay}); 8 : 9 1 : call(void Function() action) { 10 2 : _timer?.cancel(); 11 3 : _timer = Timer(delay, action); 12 : } 13 : }