workmanager
0.10.10, released 2 months ago by fluttercommunity.dev
Schedule background work and execute Dart code on Android, iOS, macOS, Web, and Linux.
What it does
Allows scheduling and executing one-off or periodic background tasks in Flutter apps, even when the application is closed. It wraps native scheduling APIs across supported platforms like Android WorkManager and iOS Background Tasks.
AI-written summary of version 0.10.10, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to perform periodic data sync or cleanup tasks in the background
- You need reliable file uploads or database maintenance while the app is closed
Skip it when
- You need precise execution timing, which background schedulers cannot guarantee
- You only need simple concurrent processing while the application is actively running
Strengths
- Supports multiple platforms including Android, iOS, macOS, web, and Linux
- Handles app closures and system reboots for scheduled tasks
- Provides support for long-running tasks, progress updates, and work status observation
Weaknesses
- Background execution is subject to strict OS limitations and power management constraints
- Experimental support for web and Linux has platform-specific limitations
Setup
- Kind
- Plugin (native code)
- Effort
- High
- Code generation
- No
- Direct dependencies
- 5
Requires native platform setup for Android and iOS background execution as specified in the quick start guide.
@pragma('vm:entry-point')
void callbackDispatcher() {
Workmanager().executeTask((task, inputData) async {
print("Background task: $task");
return Future.value(true);
});
}
void main() {
Workmanager().initialize(callbackDispatcher);
Workmanager().registerOneOffTask("task-id", "simpleTask");
runApp(MyApp());
}Alternatives
Packages that do the same job and could replace workmanager.
- screen_state
Tracks screen state events on Android and iOS.
81Compare - flutter_usb_printer
Send data and work with USB printers on Android.
69Compare
Works with
Packages commonly used together with workmanager: ones it builds on, ones built on it, and its own family.