debounce_hook 0.0.3 copy "debounce_hook: ^0.0.3" to clipboard
debounce_hook: ^0.0.3 copied to clipboard

A Flutter package that helps debouncing.

Debounce API calls or Expensive Operations.

Features #

You can use it for debouncing onChanged of TextField.

Getting started #

To install the package run following command:

flutter pub add debounce_hook

Usage #

Common useage as follows.

class MyWidget extends HookWidget {
  const MyWidget({super.key});

  @override
  Widget build(BuildContext context) {
    final debounce = useDebounce<String>(
      // in milliseconds
      debounceDelay: 500,
      callback: (value) {
        // do API call or a expensive computation
      },
    );

    return TextField(
      onChanged: (value) {
        // Common example of using debounce is using `onChanged` of
        // `TextField`.
        debounce.onChanged(value);
      },
    );
  }
}
1
likes
130
pub points
51%
popularity

Publisher

unverified uploader

A Flutter package that helps debouncing.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, flutter_hooks

More

Packages that depend on debounce_hook