mirror of
				https://github.com/AppFlowy-IO/AppFlowy.git
				synced 2025-11-03 19:43:52 +00:00 
			
		
		
		
	* chore: remove redundant arguments * chore: remove unused constructor params * chore: reorganize constructors * chore: remove unnecessary awaits in returns * chore: remove unnecessary paranthesis * chore: add lints * chore: clean up after merge * chore: add sort constructors first * chore: organize constructors in blocs * chore: use sizedbox.shrink over empty container
		
			
				
	
	
		
			25 lines
		
	
	
		
			380 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			380 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
import 'dart:async';
 | 
						|
 | 
						|
import 'package:flutter/material.dart';
 | 
						|
 | 
						|
class Debounce {
 | 
						|
  Debounce({
 | 
						|
    this.duration = const Duration(milliseconds: 1000),
 | 
						|
  });
 | 
						|
 | 
						|
  final Duration duration;
 | 
						|
  Timer? _timer;
 | 
						|
 | 
						|
  void call(VoidCallback action) {
 | 
						|
    dispose();
 | 
						|
    _timer = Timer(duration, () {
 | 
						|
      action();
 | 
						|
    });
 | 
						|
  }
 | 
						|
 | 
						|
  void dispose() {
 | 
						|
    _timer?.cancel();
 | 
						|
    _timer = null;
 | 
						|
  }
 | 
						|
}
 |