Skip to content

Commit

Permalink
feat: Add support for passing null values in Debounce and Throttle fu…
Browse files Browse the repository at this point in the history
…nctions.
  • Loading branch information
xsahil03x committed Dec 14, 2022
1 parent f6c1b6b commit 0a5e885
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/src/debounce.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class Debounce {
int _lastInvokeTime = 0;

Object? _invokeFunc(int time) {
final args = _lastArgs as List<Object>?;
final namedArgs = _lastNamedArgs as Map<Symbol, Object>?;
final args = _lastArgs as List<Object?>?;
final namedArgs = _lastNamedArgs as Map<Symbol, Object?>?;
_lastInvokeTime = time;
_lastArgs = _lastNamedArgs = _undefined;
return _result = Function.apply(_func, args, namedArgs);
Expand Down Expand Up @@ -200,7 +200,7 @@ class Debounce {
/// ```
/// fetchMovies('tenet', adult: true).
/// ```
Object? call([List<Object>? args, Map<Symbol, Object>? namedArgs]) {
Object? call([List<Object?>? args, Map<Symbol, Object?>? namedArgs]) {
final time = DateTime.now().millisecondsSinceEpoch;
final isInvoking = _shouldInvoke(time);

Expand Down
2 changes: 1 addition & 1 deletion lib/src/throttle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,6 @@ class Throttle {
/// ```
/// fetchMovies('tenet', adult: true).
/// ```
Object? call([List<Object>? args, Map<Symbol, Object>? namedArgs]) =>
Object? call([List<Object?>? args, Map<Symbol, Object?>? namedArgs]) =>
_debounce.call(args, namedArgs);
}

0 comments on commit 0a5e885

Please sign in to comment.