FLUTTER ECOSYSTEM

agilord/cron

用於 Dart 的類似 cron 的基於時間的任務排程器

cron 專案封面
Stars
122
Forks
23
最近推送(UTC)
2025年4月30日
專案狀態
未封存
Agilord, LLC GitHub avatar
GITHUB Organization

Agilord, LLC ↗

語言Dart

此儲存庫發佈的套件

使用的依賴

依賴清單 4 項

原始 README

以下為英文專案原文快照,最新內容請造訪 GitHub。

展開 / 收合專案 README

Cron

Run tasks periodically at fixed times or intervals.

pub package

Usage

A simple usage example:

import 'package:cron/cron.dart';

void main() {
  final cron = Cron();

  cron.schedule(Schedule.parse('*/3 * * * *'), () async {
    print('every three minutes');
  });

  cron.schedule(Schedule.parse('8-11 * * * *'), () async {
    print('between every 8 and 11 minutes');
  });
}

Cron parser

You can easily create and parse cron format:

import 'package:cron/cron.dart';

void main() {
  print(Schedule.parse('3-5 * * * *').minutes); // [3, 4, 5]
  
  print(Schedule(hours: 12, minutes: 25, weekdays: [2, 3])
      .toCronString()); // 25 12 * * 2,3
}

Links