just_debounce_it 2.1.0

just_debounce_it #

Build Status

A simple debounce library.

import 'package:just_debounce_it/just_debounce_it.dart';

Debounce.milliseconds(1000, print, ["Debounce World!"]);

Static methods #

There are three methods available for debouncing. All methods differ only by the first parameter used to specify timeout values in different formats:

Debounce.seconds(int timeoutSeconds, Function target, [List<dynamic> args])
Debounce.milliseconds(int timeoutMs, Function target, [List<dynamic> args])
Debounce.duration(Duration timeout, Function target, [List<dynamic> args])

To immediately dispatch a target that has previously been debounced, use runAndClear. Optional args can be provided to override the debounced arguments:

Debounce.runAndClear(Function target, [List<dynamic> args])

To clear a debounced target:

Debounce.clear(Function target)

Example #

A quick demonstration can be found in the example directory. To run the example:

pub run example/main.dart

Credits #

https://gist.github.com/marc-hughes/8302149 https://github.com/dtq

Changelog #

2.0.0 #

  • Update dependencies for Dart 2.0.
  • Remove explicity analysis options YAML.
  • Add runAndClear method to immediately dispatch a debounced target.

1.0.4 #

  • Run dartfmt.
  • Adjust analysis_options.yaml and fix issues.
  • Add travis YAML.

1.0.3 #

  • Move project into repo. Fix typos in README.md.

1.0.2 #

  • Clean-up README.md.

1.0.1 #

  • Improved documentation. Added example.

1.0.0 #

  • Initial version of a debounce library.


import 'package:just_debounce_it/just_debounce_it.dart';

void main() {
  void printSeconds() => print("Hello World (Debounce.seconds)");
  Debounce.seconds(1, printSeconds);
  Debounce.runAndClear(printSeconds); // Will print immediately

  void printMs() => print("Hello World (Debounce.milliseconds)");
  Debounce.milliseconds(500, printMs);
  Debounce.clear(printMs); // Will not run

  final duration = const Duration(milliseconds: 2000);
  Debounce.duration(duration, print, ["Hello World (Debounce.duration)"]);
  Debounce.duration(duration, print, ["Hello World (Debounce.duration)"]);
  Debounce.duration(duration, print, ["Hello World (Debounce.duration)"]);
  Debounce.duration(duration, print, ["Hello World (Debounce.duration)"]);
  Debounce.duration(duration, print, ["Hello World (Debounce.duration)"]);

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  just_debounce_it: ^2.1.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:just_debounce_it/just_debounce_it.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jul 17, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:just_debounce_it/just_debounce_it.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
Dev dependencies
test ^1.3.0