just_debounce_it 2.0.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 74

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])

And one method exists for immediately dispatching a target that has previously been debounced:

Debounce.runAndClear(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.

example/main.dart

import 'package:just_debounce_it/just_debounce_it.dart';

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

  void printMs() => print("Hello World (Debounce.milliseconds)");
  Debounce.milliseconds(500, printMs);
  Debounce.milliseconds(500, printMs);
  Debounce.milliseconds(500, printMs);
  Debounce.milliseconds(500, printMs);
  Debounce.milliseconds(500, printMs);

  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:


dependencies:
  just_debounce_it: ^2.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages 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';
  
Version Uploaded Documentation Archive
2.0.0 Aug 8, 2018 Go to the documentation of just_debounce_it 2.0.0 Download just_debounce_it 2.0.0 archive
1.0.4 Apr 12, 2018 Go to the documentation of just_debounce_it 1.0.4 Download just_debounce_it 1.0.4 archive
1.0.3 Feb 9, 2018 Go to the documentation of just_debounce_it 1.0.3 Download just_debounce_it 1.0.3 archive
1.0.2 Feb 9, 2018 Go to the documentation of just_debounce_it 1.0.2 Download just_debounce_it 1.0.2 archive
1.0.1 Feb 9, 2018 Go to the documentation of just_debounce_it 1.0.1 Download just_debounce_it 1.0.1 archive
1.0.0 Feb 9, 2018 Go to the documentation of just_debounce_it 1.0.0 Download just_debounce_it 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
57
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
74
Learn more about scoring.

We analyzed this package on Oct 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.4

Platforms

Detected platforms: Flutter, web, other

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

Maintenance suggestions

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Dependencies

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