Skip to content
pubscout

flutter_background_executor

1.0.0, released 4 years ago by dsr-corporation.com

Run scheduled refresh tasks and immediate background tasks on Android and iOS.

WASM-ready
$ flutter pub add flutter_background_executor
Source repository

What it does

This plugin executes background tasks by spinning up new Flutter engines. It supports both scheduled refresh tasks using WorkManager on Android and BackgroundTasks on iOS, as well as immediate background tasks with optional inter-task messaging and task management controls.

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

Use it when

  • You need to run scheduled background data sync or refresh tasks.
  • You need to trigger and manage immediate background execution tasks.
  • You need communication between the main app and background tasks.

Skip it when

  • You are using Flutter SDK older than 3.0.0 or Dart older than 2.17.0.
  • You need to communicate with scheduled refresh tasks (communication is limited to immediate tasks).
  • Libraries used inside your background tasks are not compatible with multiple Flutter engines.

Strengths

  • Supports both scheduled refresh and immediate tasks natively on Android and iOS.
  • Provides inter-task messaging and execution management (checking status and stopping tasks).
  • Exposes configurable options for battery, network, storage, and delays on Android.

Weaknesses

  • Scheduled refresh tasks cannot communicate with other tasks.
  • iOS requires specific AppDelegate or UserDefaults configuration and native capability setup.
  • Some libraries may not work correctly out-of-the-box when run inside a secondary background Flutter engine.

Setup

Kind
Plugin (native code)
Effort
Medium
Code generation
No
Direct dependencies
2

Requires adding Background Modes capabilities ('Background fetch' and 'Background processing') and configuring BGTaskSchedulerPermittedIdentifiers in Info.plist for iOS. Android requires SDK 21+.

await FlutterBackgroundExecutor().createRefreshTask(
  callback: refresh,
  settings: RefreshTaskSettings(
    androidDetails: AndroidRefreshTaskDetails(),
    iosDetails: IosRefreshTaskDetails(taskIdentifier: 'com.dsr_corporation.refresh-task'),
  ),
);

@pragma('vm:entry-point')
Future<void> refresh() async {
  print('Called refresh task');
}

Alternatives

Packages that do the same job and could replace flutter_background_executor.

Works with

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