countdown 0.1.0

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

I need help to update this package because I'm not playing with dart anymore #

Countdown - yet another countdown !! #

Countdown is countdown with pause/resume controls.

Install here

Simple use #

import 'package:countdown/countdown.dart';

main() {
    CountDown cd = CountDown(Duration(seconds : 10));
    var sub = cd.stream.listen(null);

    // start your countdown by registering a listener
    sub.onData((Duration d) {
        print(d);
    });

    // when it finish the onDone cb is called
    sub.onDone(() {
        print("done");
    });
}

Use with controls #

import 'package:countdown/countdown.dart';
import 'dart:async';

main() {

    CountDown cd = CountDown(Duration(seconds : 10));
    var sub = cd.stream.listen(null);

    sub.onData((Duration d) {
        print(d);
    });

    sub.onDone(() {
        print("done");
    });

    /// the countdown will have 500ms delay
    Timer(Duration(milliseconds: 4000), () {
        sub.pause();
    });
    Timer(Duration(milliseconds: 4500), () {
        sub.resume();
    });

}

Tests #

dart test/all_test.dart

Changelog #

0.1.0 #

  • update test package to support dart sdk 2.0+

0.0.3 #

  • update README

0.0.2 #

  • countdown ready with example and test

0.0.1 #

  • Initial version, created by Stagehand

example/countdown.dart

// Copyright (c) 2015, Benjamin NGUYEN. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

library countdown.example;

import 'package:countdown/countdown.dart';
import 'dart:async';

main() {
  CountDown cd = CountDown(Duration(seconds: 10));
  var sub = cd.stream.listen(null);

  sub.onData((Duration d) {
    print(d);
  });

  sub.onDone(() {
    print("done");
  });

  Timer(Duration(milliseconds: 4000), () {
    sub.pause();
  });

  Timer(Duration(milliseconds: 4800), () {
    sub.resume();
  });
}

Use this package as a library

1. Depend on it

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


dependencies:
  countdown: ^0.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:countdown/countdown.dart';
  
Version Uploaded Documentation Archive
0.1.0 Jan 28, 2019 Go to the documentation of countdown 0.1.0 Download countdown 0.1.0 archive
0.0.3 Jan 3, 2015 Go to the documentation of countdown 0.0.3 Download countdown 0.0.3 archive
0.0.2 Jan 3, 2015 Go to the documentation of countdown 0.0.2 Download countdown 0.0.2 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
89
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
89
Overall:
Weighted score of the above. [more]
92
Learn more about scoring.

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

  • Dart: 2.3.2
  • pana: 0.12.18

Platforms

Detected platforms: Flutter, web, other

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

Health suggestions

Fix lib/src/countdown_base.dart. (-1 points)

Analysis of lib/src/countdown_base.dart reported 2 hints:

line 23 col 24: Use = to separate a named parameter from its default value.

line 23 col 73: Use = to separate a named parameter from its default value.

Maintenance suggestions

The package description is too short. (-11 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.

Dependencies

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