showUntilDone static method

Widget showUntilDone(
  1. String onceKey, {
  2. Key? key,
  3. required Widget? builder(
    1. VoidCallback dismiss
    ),
  4. Widget? fallback()?,
  5. bool debugCallback = false,
  6. bool debugFallback = false,
})

A generic builder that keeps rendering until the user dismisses it.

The builder receives a dismiss callback function. When dismiss is called, the onceKey is marked as "done" in SharedPreferences. Subsequent builds with the same onceKey will render the fallback instead of executing the builder.

Useful for onboarding banners, "Rate Us" prompts, or one-time tutorials that stay visible until explicitly closed by the user.

Implementation

static Widget showUntilDone(
  String onceKey, {
  Key? key,
  required Widget? Function(VoidCallback dismiss) builder,
  Widget? Function()? fallback,
  bool debugCallback = false,
  bool debugFallback = false,
}) {
  return OnceBuilder.build(
    key,
    OnceRunner.runUntilDone(
      key: onceKey,
      callback: builder,
      fallback: fallback,
      debugCallback: debugCallback,
      debugFallback: debugFallback,
    ),
    fallback,
  );
}