Skip to content
pubscout

once

1.8.1, released 7 weeks ago by mosoliman.tech

Run code or show widgets once, daily, weekly, monthly, or on new app versions.

$ flutter pub add once
Source repository

What it does

Provides utility methods and widgets to execute code blocks or render specific UI elements based on time intervals, version changes, build counts, or until explicitly dismissed. It persists execution state locally using shared preferences.

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

Use it when

  • You need to show a guided tour or onboarding tutorial exactly once.
  • You want to display release notes or changelogs only when a new app version launches.
  • You need to prompt users for app ratings periodically on a weekly or monthly basis.

Skip it when

  • You need a full-featured local database or secure storage solution.
  • You require complex relational queries or large-scale document storage.

Strengths

  • Supports a wide range of scheduling and recurrence rules (daily, weekly, monthly, custom durations).
  • Provides both imperative runner functions and declarative widgets (`OnceWidget`).
  • Includes dismissal tracking via `runUntilDone` and `showUntilDone`.

Weaknesses

  • Relies entirely on device local time and `shared_preferences`, which can be manipulated or cleared by users.
  • Not suited for complex state management beyond execution tracking.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
2

No native platform steps or build_runner required; depends on shared_preferences and package_info_plus.

Once.runOnEveryNewVersion(
  callback: () {
    /* What's new dialog */
  },
  fallback: () {
    /* Fallback action */
  },
);

Alternatives

Packages that do the same job and could replace once.

Works with

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