Skip to content
pubscout

flutter_foreground_task

11.0.3, released 2 months ago by pravera.me

Implement and manage foreground services on Android and iOS platforms.

$ flutter pub add flutter_foreground_task
Source repository

What it does

This plugin allows you to run long-running repetitive tasks in a foreground service with continuous notification support. It provides two-way communication between the background task handler and the main UI isolate, along with automatic restart capabilities.

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

Use it when

  • You need to execute repetitive background tasks that shouldn't be killed immediately when the app is minimized
  • You want to display an ongoing notification for a persistent service on Android and iOS

Skip it when

  • You only need simple short-lived asynchronous background tasks
  • You want a fully cross-platform solution without platform-specific manifest or Info.plist configuration

Strengths

  • Supports two-way communication between the background task and the main UI
  • Provides options to automatically resume the foreground service on boot or package update
  • Includes utilities for handling battery optimizations and notifications

Weaknesses

  • Requires manual configuration of platform-specific permissions, Gradle files, and Android Manifest services
  • iOS background execution is heavily limited by the operating system

Setup

Kind
Plugin (native code)
Effort
High
Code generation
No
Direct dependencies
3

Requires modifying AndroidManifest.xml with specific foreground service types and permissions, setting up Gradle and Kotlin versions, configuring Info.plist on iOS, and setting the plugin registrant callback in AppDelegate.

void main() {
  FlutterForegroundTask.initCommunicationPort();
  runApp(const ExampleApp());
}

Alternatives

Packages that do the same job and could replace flutter_foreground_task.

Works with

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