Skip to content

Commit ffe13e6

Browse files
committed
feat: create comprehensive docs.page documentation structure
- Dramatically shortened README by 90% to focus on quick start - Created usecase-driven documentation with platform specifics integrated - Added comprehensive docs.page configuration with proper navigation - Created detailed platform setup guides (Android/iOS) - Added usecase-driven guides: data sync, file uploads, cleanup, notifications - Restructured documentation to be more actionable and user-focused - README now refers to docs.page for comprehensive documentation
1 parent db5111e commit ffe13e6

File tree

11 files changed

+1759
-399
lines changed

11 files changed

+1759
-399
lines changed

README.md

Lines changed: 44 additions & 396 deletions
Large diffs are not rendered by default.

docs.json

Lines changed: 108 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,110 @@
11
{
2-
"name": "Workmanager",
3-
"description": "Workmanager"
2+
"name": "Flutter Workmanager",
3+
"$schema": "https://mintlify.com/schema.json",
4+
"logo": {
5+
"dark": "/logo/dark.svg",
6+
"light": "/logo/light.svg"
7+
},
8+
"favicon": "/favicon.svg",
9+
"colors": {
10+
"primary": "#0D9373",
11+
"light": "#07C983",
12+
"dark": "#0D9373",
13+
"anchors": {
14+
"from": "#0D9373",
15+
"to": "#07C983"
16+
}
17+
},
18+
"topbarLinks": [
19+
{
20+
"name": "Support",
21+
"url": "https://github.com/fluttercommunity/flutter_workmanager/issues"
22+
}
23+
],
24+
"topbarCtaButton": {
25+
"name": "GitHub",
26+
"url": "https://github.com/fluttercommunity/flutter_workmanager"
27+
},
28+
"tabs": [
29+
{
30+
"name": "API Reference",
31+
"url": "api-reference"
32+
}
33+
],
34+
"anchors": [
35+
{
36+
"name": "Documentation",
37+
"icon": "book-open-cover",
38+
"url": "https://pub.dev/documentation/workmanager/latest/"
39+
},
40+
{
41+
"name": "Community",
42+
"icon": "github",
43+
"url": "https://github.com/fluttercommunity/flutter_workmanager"
44+
}
45+
],
46+
"navigation": [
47+
{
48+
"group": "Get Started",
49+
"pages": [
50+
"introduction",
51+
"installation",
52+
"quickstart"
53+
]
54+
},
55+
{
56+
"group": "Use Cases",
57+
"pages": [
58+
"usecases/data-sync",
59+
"usecases/periodic-cleanup",
60+
"usecases/upload-files",
61+
"usecases/fetch-notifications",
62+
"usecases/database-maintenance"
63+
]
64+
},
65+
{
66+
"group": "Task Management",
67+
"pages": [
68+
"tasks/scheduling",
69+
"tasks/constraints",
70+
"tasks/cancellation"
71+
]
72+
},
73+
{
74+
"group": "Platform Setup",
75+
"pages": [
76+
"setup/android",
77+
"setup/ios"
78+
]
79+
},
80+
{
81+
"group": "Debugging & Testing",
82+
"pages": [
83+
"debugging/overview",
84+
"debugging/notifications",
85+
"debugging/troubleshooting"
86+
]
87+
},
88+
{
89+
"group": "Advanced",
90+
"pages": [
91+
"advanced/architecture",
92+
"advanced/migration",
93+
"advanced/publishing"
94+
]
95+
},
96+
{
97+
"group": "API Reference",
98+
"pages": [
99+
"api-reference/workmanager",
100+
"api-reference/workmanager-android",
101+
"api-reference/workmanager-apple",
102+
"api-reference/platform-interface"
103+
]
104+
}
105+
],
106+
"footerSocials": {
107+
"github": "https://github.com/fluttercommunity/flutter_workmanager",
108+
"discord": "https://discord.gg/rflutterdev"
4109
}
5-
110+
}

docs/installation.mdx

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
title: Installation
3+
description: "Install Flutter Workmanager and configure your project"
4+
---
5+
6+
# Installation
7+
8+
## Add to pubspec.yaml
9+
10+
```yaml pubspec.yaml
11+
dependencies:
12+
workmanager: ^0.8.0
13+
```
14+
15+
```bash
16+
flutter pub get
17+
```
18+
19+
## Platform Configuration
20+
21+
Before using background tasks, you need to configure each platform:
22+
23+
<CardGroup cols={2}>
24+
<Card title="Android Setup" icon="android" href="/setup/android">
25+
5-minute Android WorkManager setup
26+
</Card>
27+
<Card title="iOS Setup" icon="apple" href="/setup/ios">
28+
iOS background processing configuration
29+
</Card>
30+
</CardGroup>
31+
32+
<Warning>
33+
Background tasks **will not work** without proper platform configuration. Complete the setup for your target platforms before proceeding.
34+
</Warning>
35+
36+
## Initialize Workmanager
37+
38+
Add this to your `main.dart`:
39+
40+
```dart main.dart
41+
import 'package:workmanager/workmanager.dart';
42+
43+
@pragma('vm:entry-point')
44+
void callbackDispatcher() {
45+
Workmanager().executeTask((task, inputData) {
46+
// Your background task logic here
47+
return Future.value(true);
48+
});
49+
}
50+
51+
void main() {
52+
Workmanager().initialize(callbackDispatcher);
53+
runApp(MyApp());
54+
}
55+
```
56+
57+
<Info>
58+
You only need to initialize Workmanager once in your app. The federated architecture automatically handles platform-specific implementations.
59+
</Info>
60+
61+
## Next Steps
62+
63+
Choose your use case to get started quickly:
64+
65+
<CardGroup cols={2}>
66+
<Card title="Sync Data Regularly" icon="arrows-rotate" href="/usecases/data-sync">
67+
Fetch remote data in the background
68+
</Card>
69+
<Card title="Clean Up Storage" icon="trash" href="/usecases/periodic-cleanup">
70+
Remove old files and cache data
71+
</Card>
72+
<Card title="Upload Files" icon="cloud-arrow-up" href="/usecases/upload-files">
73+
Upload photos and documents in background
74+
</Card>
75+
<Card title="Check Notifications" icon="bell" href="/usecases/fetch-notifications">
76+
Fetch new notifications from server
77+
</Card>
78+
</CardGroup>

docs/introduction.mdx

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
title: Introduction
3+
description: "Flutter WorkManager - Background task execution for Flutter apps"
4+
---
5+
6+
# Flutter Workmanager
7+
8+
[![pub package](https://img.shields.io/pub/v/workmanager.svg)](https://pub.dartlang.org/packages/workmanager)
9+
[![pub points](https://img.shields.io/pub/points/workmanager)](https://pub.dev/packages/workmanager/score)
10+
[![likes](https://img.shields.io/pub/likes/workmanager)](https://pub.dev/packages/workmanager/score)
11+
[![popularity](https://img.shields.io/pub/popularity/workmanager)](https://pub.dev/packages/workmanager/score)
12+
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/fluttercommunity/flutter_workmanager/test.yml?branch=main&label=tests)](https://github.com/fluttercommunity/flutter_workmanager/actions)
13+
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/fluttercommunity/flutter_workmanager/blob/main/LICENSE)
14+
15+
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.
16+
17+
<Info>
18+
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.
19+
</Info>
20+
21+
This is especially useful to run periodic tasks, such as fetching remote data on a regular basis.
22+
23+
<Note>
24+
This plugin was featured in this [Medium blogpost](https://medium.com/vrt-digital-studio/flutter-workmanager-81e0cfbd6f6e)
25+
</Note>
26+
27+
## Federated Plugin Architecture
28+
29+
This plugin uses a federated architecture, which means that the main `workmanager` package provides the API, while platform-specific implementations are in separate packages:
30+
31+
<CardGroup cols={2}>
32+
<Card title="workmanager" icon="dart-lang">
33+
The main package that provides the unified API
34+
</Card>
35+
<Card title="workmanager_platform_interface" icon="code">
36+
The common platform interface
37+
</Card>
38+
<Card title="workmanager_android" icon="android">
39+
Android-specific implementation
40+
</Card>
41+
<Card title="workmanager_apple" icon="apple">
42+
Apple platform (iOS/macOS) implementation
43+
</Card>
44+
</CardGroup>
45+
46+
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.
47+
48+
## Key Features
49+
50+
<AccordionGroup>
51+
<Accordion title="Background Task Execution">
52+
Execute Dart code in the background on both Android and iOS platforms
53+
</Accordion>
54+
55+
<Accordion title="Multiple Task Types">
56+
Support for one-off tasks, periodic tasks, and iOS processing tasks
57+
</Accordion>
58+
59+
<Accordion title="Platform Constraints">
60+
Configure network, battery, charging, and other constraints for task execution
61+
</Accordion>
62+
63+
<Accordion title="Debug Support">
64+
Built-in debugging with notifications to track background task execution
65+
</Accordion>
66+
</AccordionGroup>
67+
68+
## Supported Platforms
69+
70+
| Platform | Support | Notes |
71+
|----------|---------|--------|
72+
| Android | ✅ Full | All WorkManager features supported |
73+
| iOS | ✅ Full | Background Fetch + BGTaskScheduler APIs |
74+
| macOS | 🚧 Planned | Future support through NSBackgroundActivityScheduler |
75+
| Web | ❌ Not supported | Background execution not available |
76+
| Windows/Linux | ❌ Not supported | No background task APIs |
77+
78+
## Getting Started
79+
80+
Ready to add background tasks to your Flutter app? Let's get started!
81+
82+
<Card title="Quick Start Guide" icon="rocket" href="/quickstart">
83+
Learn how to set up and use Flutter Workmanager in your app
84+
</Card>

0 commit comments

Comments
 (0)