shawon1fb

Debouncer sound null safety

@@ -9,14 +9,14 @@ import 'dart:async'; @@ -9,14 +9,14 @@ import 'dart:async';
9 /// delayed( () => print( 'called after 1 sec' )); 9 /// delayed( () => print( 'called after 1 sec' ));
10 /// ``` 10 /// ```
11 class Debouncer { 11 class Debouncer {
12 - final Duration? delay; 12 + final Duration delay;
13 Timer? _timer; 13 Timer? _timer;
14 14
15 - Debouncer({this.delay}); 15 + Debouncer({required this.delay});
16 16
17 void call(void Function() action) { 17 void call(void Function() action) {
18 _timer?.cancel(); 18 _timer?.cancel();
19 - _timer = Timer(delay!, action); 19 + _timer = Timer(delay, action);
20 } 20 }
21 21
22 /// Notifies if the delayed call is active. 22 /// Notifies if the delayed call is active.