NakiDebounce class

NakiDebounce provides utility methods for debouncing function executions.

This is useful for rate-limiting operations that are triggered frequently, such as text field input events or window resizing.

Example

NakiDebounce.run(
  'user-input-debounce',
  Duration(milliseconds: 300),
  () {
    print('Triggered after 300ms of inactivity');
  },
);

Constructors

NakiDebounce()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

count → int
Returns the number of active debounce operations that are currently pending.
no setter

Static Methods

cancel(String tag) → void
Cancels the active debounce operation for tag without executing its callback.
cancelAll() → void
Cancels all active debounce operations without executing their callbacks.
fire(String tag) → void
Immediately executes the callback associated with tag and cancels its timer.
run(String tag, Duration duration, void onExecute()) → void
Schedules the execution of onExecute after duration.