workmanager
Flutter Workmanager. 이 플러그인을 사용하면 Android 및 iOS에서 백그라운드 작업을 예약할 수 있습니다.
Android 및 iOS에서 백그라운드에서 코드를 실행할 수 있는 Flutter 플러그인입니다.
Flutter Workmanager. 이 플러그인을 사용하면 Android 및 iOS에서 백그라운드 작업을 예약할 수 있습니다.
workmanager 플러그인의 Apple 플랫폼(iOS/macOS) 구현.
워크매니저 플러그인을 위한 일반적인 플랫폼 인터페이스입니다.
백그라운드 작업 실행을 위해 Service Worker와 Web Worker를 사용한 작업 관리자의 실험적 웹 구현.
^6.0.0아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
pub package pub points likes popularity GitHub Workflow Status license
Execute Dart code in the background, even when your app is closed (Android and iOS). On macOS, background tasks run while the app is running or backgrounded and the Mac is awake. Perfect for data sync, file uploads, and periodic maintenance tasks.
⚠️ Experimental web support now exists via
workmanager_web(Service Worker + Web Worker based background execution). See the Web (experimental) page and the package README for honest limitations and how to test it in Chrome.
Get started with background tasks in Flutter:
→ Quick Start Guide - Installation and setup
→ API Documentation - Complete Dart API reference
→ Debugging Guide - Troubleshooting help
→ Troubleshooting Guide - Why tasks stop after app close (OEM battery optimization, constraints, verification)
Background tasks are perfect for:
For work that takes longer than the regular background execution window (bulk
uploads/downloads, ML processing), Android tasks can run as a foreground
service with a persistent notification. Pass a foregroundServiceConfig to
registerOneOffTask or registerPeriodicTask:
await Workmanager().registerOneOffTask(
"upload-task",
"upload_files",
foregroundServiceConfig: ForegroundServiceConfig(
notificationTitle: "Uploading files",
notificationText: "Your files are being uploaded",
),
);
See the Quick Start guide for details and platform caveats.
cancelByUniqueName, cancelByTag and cancelAll stop the WorkManager worker
immediately, but the Dart callback that is currently running keeps executing
unless it reacts to the stop. Pass an onTaskStopped handler to executeTask
inside your callbackDispatcher to be notified when a running task is stopped
before it finishes:
@pragma('vm:entry-point')
void callbackDispatcher() {
Workmanager().executeTask(
(taskName, inputData) async {
return true;
},
onTaskStopped: (taskName, stopReason) async {
// Mark the task as cancelled / persist state, then return promptly.
},
);
}
The handler receives the task name and the WorkManager stop reason
(cancelledByApp, timeout, preempt, ...); on Android < 12 the reason is
StopReason.unknown. Android-only — iOS has no way to stop a running task.
See the Customization guide
for details.
See the example folder for a complete working demo with all task types and platform configurations.