chronograph 1.0.0 copy "chronograph: ^1.0.0" to clipboard
chronograph: ^1.0.0 copied to clipboard

Lightweight reactive stopwatch/countdown for Flutter. ChronoGraph provides ValueListenable for stopwatch, timer, and DateTime countdown, plus a tiny ChronoView.

Pub Version GitHub GitHub GitHub

Chronograph is a lightweight, reactive engine for stopwatch and countdown use‑cases in Flutter. It exposes a simple ValueListenable

Features #

  • Reactive engine: expose ValueListenable<Chrono> for easy UI updates
  • Three modes: stopwatch, timer(duration), countdown(date)
  • Tiny view helper: ChronoView wraps ValueListenableBuilder<Chrono>
  • Configurable tick interval and display level (days/hours/minutes/seconds)
  • Optional autostart and onCompleted callback for countdowns/timers
  • Immutable Chrono value with padded strings and total time helpers
  • Pure Dart implementation — no platform channels, test‑friendly

Usage #

For a complete usage, please see the example.

To read more about classes and other references used by chronograph, see the API Reference.

Stopwatch (count up) #

final graph = ChronoGraph.stopwatch(
  level: ChronoLevel.seconds,
  interval: const Duration(seconds: 1),
  autostart: false, // call start() manually
);

// Control
graph.start();
graph.pause();
graph.reset();

// Build UI
ChronoView(
  graph: graph,
  builder: (context, info, _) => Text(
    '${info.paddedMinutes}:${info.paddedSeconds}',
  ),
);

Timer (fixed duration) #

final timer = ChronoGraph.timer(
  duration: const Duration(seconds: 10),
  autostart: true,
  onCompleted: () => debugPrint('Timer completed'),
);

ChronoView(
  graph: timer,
  builder: (context, info, _) => Text(
    '${info.paddedMinutes}:${info.paddedSeconds}',
  ),
);

Countdown to a DateTime #

final countdown = ChronoGraph.countdown(
  date: DateTime(2025, 1, 1), // target date
  autostart: true,
  onCompleted: () => debugPrint('Happy New Year!'),
);

ChronoView(
  graph: countdown,
  builder: (context, info, _) => Text(
    '${info.paddedMinutes}:${info.paddedSeconds}',
  ),
);

Sponsoring #

Buy Me A Coffee Ko-Fi

If this package or any other package I created is helping you, please consider to sponsor me so that I can take time to read the issues, fix bugs, merge pull requests and add features to these packages.

1
likes
0
points
16
downloads

Publisher

verified publisherwidgetarian.com

Weekly Downloads

Lightweight reactive stopwatch/countdown for Flutter. ChronoGraph provides ValueListenable for stopwatch, timer, and DateTime countdown, plus a tiny ChronoView.

Homepage
Repository (GitHub)
View/report issues

Topics

#chronograph #countdown #stopwatch #timer

Funding

Consider supporting this project:

buymeacoffee.com
ko-fi.com

License

unknown (license)

Dependencies

flutter

More

Packages that depend on chronograph