Skip to content
pubscout

cron

0.6.2, released 2 years ago by agilord.com

A Dart scheduler that runs tasks at cron‑style times or intervals.

WASM-ready
$ flutter pub add cron
Source repository

What it does

Provides a Cron class to schedule callbacks based on cron expressions or fixed intervals. Parses standard 5‑part or 6‑part cron strings and supports mocking time via the clock package.

AI-written summary of version 0.6.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need periodic background work in a pure Dart or Flutter app
  • You want cron‑like scheduling without native platform code
  • You need to test time‑dependent code with mockable clocks

Skip it when

  • Precise sub‑second timing is required
  • You need distributed job coordination across multiple devices

Strengths

  • Simple API with string‑based schedules
  • Supports intervals, seconds, and mockable time
  • Null‑safe and pure Dart, works on all platforms

Weaknesses

  • No built‑in persistence; tasks disappear on app restart
  • Limited to single‑process scheduling
  • No advanced features like job queues or retries

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
1
import 'package:cron/cron.dart';

void main() {
  final cron = Cron();
  cron.schedule(Schedule.parse('*/5 * * * *'), () async {
    print('runs every 5 minutes');
  });
}

Works with

Packages commonly used together with cron: ones it builds on, ones built on it, and its own family.