Skip to content
pubscout

scheduled_timer

2.0.1, released 5 years ago by magnuswikhog.com

A simple timer that can be scheduled for a specific time and persists across app restarts.

WASM-ready
$ flutter pub add scheduled_timer
Source repository

What it does

It lets you schedule a callback to run at a given DateTime instead of after a delay. The scheduled time is saved with SharedPreferences and restored after the app restarts. If the time is missed, an optional callback can handle it.

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

Use it when

  • You need a lightweight, in‑app timer that survives restarts without background services
  • You want to avoid platform‑specific alarm APIs and keep everything in Dart

Skip it when

  • The app may be terminated or in the background and you need the timer to fire anyway
  • You require high‑precision or OS‑level scheduling

Strengths

  • Persists schedule across restarts
  • Simple declarative API
  • No native code required

Weaknesses

  • Runs only while the app is active
  • Cannot wake the device or execute in background
  • Limited to Flutter’s event loop

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
1
ScheduledTimer myTimer = ScheduledTimer(
  id: 'myTimer',
  onExecute: () => print('Executing myTimer'),
  defaultScheduledTime: DateTime.now().add(Duration(minutes: 10)),
  onMissedSchedule: () {
    print('myTimer missed the scheduled time');
    myTimer.execute();
  },
);

Works with

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