Skip to content
pubscout

flutter_background

1.3.1, released 8 months ago by julianassmann.de

Runs a Flutter app in the background on Android using a foreground service.

WASM-ready
$ flutter pub add flutter_background
Source repository

What it does

The plugin starts a foreground Android service with a persistent notification to keep the Dart isolate alive. It also acquires a partial wake lock and can disable battery optimizations to allow continuous execution.

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

Use it when

  • continuous data sync or messaging that must run when the app is not visible
  • long‑running network connections that need to survive screen off

Skip it when

  • iOS or cross‑platform projects that need background support on other platforms
  • scenarios where a foreground notification would be undesirable

Strengths

  • Supports Android 14+ foreground‑service requirements
  • Handles wake lock and battery‑optimization permissions automatically
  • Simple API to enable/disable background execution

Weaknesses

  • Android‑only; no iOS support
  • Requires a persistent notification, which may affect user experience

Setup

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

Add FOREGROUND_SERVICE permissions and a <service> entry with appropriate foregroundServiceType in AndroidManifest.xml; call FlutterBackground.initialize with notification config before enabling execution

import 'package:flutter_background/flutter_background.dart';

final config = FlutterBackgroundAndroidConfig(
  notificationTitle: 'My app',
  notificationText: 'Running in background',
  notificationImportance: AndroidNotificationImportance.normal,
  notificationIcon: AndroidResource(name: 'background_icon', defType: 'drawable'),
);
await FlutterBackground.initialize(androidConfig: config);
await FlutterBackground.enableBackgroundExecution();

Alternatives

Packages that do the same job and could replace flutter_background.

Works with

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