raad-raavis-arman / lambda

Lambda client app, showing advetisement
Apache License 2.0
0 stars 0 forks source link

Add Debouncer for search textfields inside home page and searchable list widget #93

Open TalebRafiepour opened 4 months ago

TalebRafiepour commented 4 months ago
class Debouncer {
final int milliseconds;
Timer? timer;

Debouncer({required this.milliseconds});

void run(VoidCallback action){
if(timer != null){
timer!.cancel();
}
}
timer = Timer(Duration(milliseconds: milliseconds), action);

void reset(){
timer = null;
}
}