|
1 | 1 | # Flutter Workmanager |
2 | 2 |
|
3 | 3 | [](https://pub.dartlang.org/packages/workmanager) |
4 | | -[](https://cirrus-ci.com/github/vrtdev/flutter_workmanager/) |
5 | | -======= |
| 4 | +[](https://pub.dev/packages/workmanager/score) |
| 5 | +[](https://pub.dev/packages/workmanager/score) |
| 6 | +[](https://pub.dev/packages/workmanager/score) |
| 7 | +[](https://github.com/fluttercommunity/flutter_workmanager/actions) |
| 8 | +[](https://github.com/fluttercommunity/flutter_workmanager/blob/main/LICENSE) |
6 | 9 |
|
7 | 10 | Flutter WorkManager is a wrapper around [Android's WorkManager](https://developer.android.com/topic/libraries/architecture/workmanager), [iOS' performFetchWithCompletionHandler](https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623125-application) and [iOS BGAppRefreshTask](https://developer.apple.com/documentation/backgroundtasks/bgapprefreshtask), effectively enabling headless execution of Dart code in the background. |
8 | 11 |
|
9 | | -For iOS users, please watch this video on a general introduction to background processing: https://developer.apple.com/videos/play/wwdc2019/707 ( and old link for [Background execution demystified (WWDC 2020)](https://devstreaming-cdn.apple.com/videos/wwdc/2020/10063/3/2E1C3BA0-2643-4330-A5B2-3A9878453987/wwdc2020_10063_hd.mp4). All of the constraints discussed in the video also apply to this plugin. |
| 12 | +For iOS users, please watch this video on a general introduction to background processing: https://developer.apple.com/videos/play/wwdc2019/707. All of the constraints discussed in the video also apply to this plugin. |
10 | 13 |
|
11 | 14 | This is especially useful to run periodic tasks, such as fetching remote data on a regular basis. |
12 | 15 |
|
13 | 16 | > This plugin was featured in this [Medium blogpost](https://medium.com/vrt-digital-studio/flutter-workmanager-81e0cfbd6f6e) |
14 | 17 |
|
| 18 | +## Federated Plugin Architecture |
| 19 | + |
| 20 | +This plugin uses a federated architecture, which means that the main `workmanager` package provides the API, while platform-specific implementations are in separate packages: |
| 21 | + |
| 22 | +- **workmanager**: The main package that provides the unified API |
| 23 | +- **workmanager_platform_interface**: The common platform interface |
| 24 | +- **workmanager_android**: Android-specific implementation |
| 25 | +- **workmanager_ios**: iOS-specific implementation |
| 26 | + |
| 27 | +This architecture allows for better platform-specific optimizations and easier maintenance. When you add `workmanager` to your `pubspec.yaml`, the platform-specific packages are automatically included through the endorsed federated plugin system. |
| 28 | + |
15 | 29 | # Platform Setup |
16 | 30 |
|
17 | 31 | In order for background work to be scheduled correctly you should follow the Android and iOS setup first. |
@@ -276,7 +290,7 @@ Workmanager().registerOneOffTask("1", "simpleTask", tag: "tag"); |
276 | 290 | ## Existing Work Policy |
277 | 291 |
|
278 | 292 | Indicates the desired behaviour when the same task is scheduled more than once. |
279 | | -The default is `KEEP` |
| 293 | +The default is `keep` |
280 | 294 |
|
281 | 295 | ```dart |
282 | 296 | Workmanager().registerOneOffTask("1", "simpleTask", existingWorkPolicy: ExistingWorkPolicy.append); |
|
0 commit comments