kevintonb.

← All contributions

ffkev

background_to_foreground_check_app

Listens for app resume events with WidgetsBindingObserver, for refreshing a session, syncing data or reloading state.

A simple and reusable FlutterFlow-compatible custom action that detects when your app resumes from the background and executes defined logic.
Built with WidgetsBindingObserver, it provides a debounced, stable lifecycle callback to refresh sessions, reload data, or trigger background syncs automatically.

Features

  • Detects app resume events reliably.
  • Debounces quick consecutive triggers.
  • Works seamlessly within FlutterFlow custom actions.
  • Supports easy integration for background handling logic.

Usage

  1. Call checkBackgroundResume() after WidgetsFlutterBinding.ensureInitialized() in your main app initialization.
  2. Add your desired logic inside the onResume callback.
  3. Optionally, call dispose() if you want to stop listening to lifecycle changes.

Example

await checkBackgroundResume();

This page mirrors the repository's own README, with GitHub's boilerplate and its contributor-facing sections removed. Read it at the source ↗