Thank you for your interest in contributing to Flutter Workmanager! This guide will help you get started.
- Flutter SDK (latest stable version)
- Android Studio / Xcode for platform-specific development
- Melos for monorepo management
- Fork and clone the repository
- Install melos globally:
dart pub global activate melos - Bootstrap the workspace:
melos bootstrap - Run tests:
melos run test
This is a federated plugin with the following packages:
workmanager/- Main plugin packageworkmanager_android/- Android implementationworkmanager_apple/- iOS/macOS implementationworkmanager_platform_interface/- Shared interfaceexample/- Demo application
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes
- Run formatting:
melos run format - Run analysis:
melos run analyze - Run tests:
melos run test - Test on example app:
cd example && flutter run
If you modify the Pigeon API definition in workmanager_platform_interface/pigeons/workmanager_api.dart:
# Regenerate Pigeon files
melos run generate:pigeonImportant: Never manually edit generated *.g.* files.
The project uses specific formatting rules:
- Dart: Use
dart format(configured to exclude generated files) - Kotlin: Use
ktlint -F .in root folder - Swift: Use SwiftLint for formatting
Generated files are automatically excluded from formatting checks.
# All tests
melos run test
# Specific package tests
cd workmanager_android && flutter test
cd workmanager_apple && flutter test
# Native tests
cd example/android && ./gradlew :workmanager_android:test
cd example/ios && xcodebuild test -workspace Runner.xcworkspace -scheme Runner# iOS integration tests
melos run test:drive_ios
# Android integration tests
melos run test:drive_androidAlways build the example app before completing your changes:
cd example
flutter build apk --debug
flutter build ios --debug --no-codesign- Follow Android WorkManager best practices
- Test on various Android API levels
- Ensure background task constraints work properly
- Test both Background Fetch and BGTaskScheduler APIs
- Verify 30-second execution limits are respected
- Test on physical devices (background tasks don't work in simulator)
Before publishing any package, run the dry-run validation:
# Validate all packages are ready for publishing
melos run publish:dry-run
# Or for individual packages:
cd workmanager && dart pub publish --dry-run
cd workmanager_android && dart pub publish --dry-run
cd workmanager_apple && dart pub publish --dry-run
cd workmanager_platform_interface && dart pub publish --dry-runThis validates that:
- All dependencies are correctly specified
- No uncommitted changes exist
- Package follows pub.dev guidelines
- All required files are included
Use melos for coordinated version bumps:
# Bump versions across related packages
melos version- Ensure all tests pass:
melos run test - Run dry-run validation:
melos run publish:dry-run - Update CHANGELOGs for all modified packages
- Create release PR with version bumps
- After merge, tag release:
git tag v0.x.x - Publish packages:
melos publish --no-dry-run
- API docs: Documented inline in Dart code
- User guides: Located in
docs/directory using docs.page - Setup guides: Integrated into quickstart documentation
docs/index.mdx- Overview and featuresdocs/quickstart.mdx- Installation and basic setupdocs/customization.mdx- Advanced configurationdocs/debugging.mdx- Troubleshooting guide
Test documentation changes locally:
- Push changes to a branch
- View at:
https://docs.page/fluttercommunity/flutter_workmanager~your-branch
The project uses several CI workflows:
- Format (
.github/workflows/format.yml): Code formatting checks - Analysis (
.github/workflows/analysis.yml): Package analysis and dry-run validation - Test (
.github/workflows/test.yml): Unit tests, native tests, integration tests
All checks must pass before merging PRs.
If you see formatting or analysis errors in generated files:
- Never manually edit
*.g.*files - Use
melos run generate:pigeonto regenerate - Generated files are excluded from formatting by design
Package analysis failures: Usually caused by uncommitted changes or missing dependencies
Format failures: Run melos run format locally first
Test failures: Ensure all tests pass locally with melos run test
- Bug reports: GitHub Issues
- Questions: GitHub Discussions
- Documentation: docs.page
This project follows the Flutter Community Code of Conduct.
By contributing to Flutter Workmanager, you agree that your contributions will be licensed under the MIT License.