neat_periodic_task
2.0.1, released 4 years ago by google.dev
Auxiliary classes for reliably running periodic tasks in long-running processes.
WASM-readyQuiet but busy
What it does
Provides a framework to run periodic maintenance tasks on a loop with a long delay in background processes like a web server. It handles limits on run-times, retries failed executions, catches exceptions, and can optionally prevent concurrent tasks using storage services.
AI-written summary of version 2.0.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to run background maintenance operations inside a long-running Dart process like a web server
- You want to limit task run-time, retry failed executions, and log periodic task statuses reliably
Skip it when
- You are running client-side Flutter UI applications without long-running background server processes
- You need complex out-of-band cloud scheduling managed entirely outside of your application codebase
Strengths
- Retries failed task executions automatically after a timeout
- Limits maximum run-time to prevent hanging loops
- Catches and logs all exceptions and errors from tasks
Weaknesses
- Relies on the application process staying alive continuously
- Lacks built-in cloud cron UI configuration out of the box
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- Yes (build_runner)
- Direct dependencies
- 6
Not documented
import 'dart:io';
import 'package:neat_periodic_task/neat_periodic_task.dart';
void main() async {
final scheduler = NeatPeriodicTaskScheduler(
interval: Duration(seconds: 30),
name: 'hello-world',
timeout: Duration(seconds: 5),
task: () async => print('Hello World'),
minCycle: Duration(seconds: 5),
);
scheduler.start();
await ProcessSignal.sigterm.watch().first;
await scheduler.stop();
}Works with
Packages commonly used together with neat_periodic_task: ones it builds on, ones built on it, and its own family.
- json_annotationneat_periodic_task depends on itProvides annotations for json_serializable to generate JSON (de)serialization code.
- loggingneat_periodic_task depends on itProvides configurable logging with levels and stream listeners for Dart apps.
- retryneat_periodic_task depends on itProvides automatic retry with exponential back‑off for async functions.
- slugidneat_periodic_task depends on itURL-safe base64 encoded UUIDv4 without padding
- checked_yamlSame familyProvides checkedYamlDecode to give detailed errors when decoding YAML with json_serializable.
- json_serializableSame familyAutomatically generate code for converting Dart classes to and from JSON.
- safe_url_checkSame familyCheck if an untrusted URL is broken without allowing connections to private IP addresses.
- skills_lintSame familyStatic analysis linter and CLI tool for Agent Skills (SKILL.md) structure and metadata