Thank you for your interest in contributing to Flutter Compositions! This document provides guidelines and instructions for contributing.
Be respectful and constructive in all interactions. We're all here to learn and build great software together.
- Flutter SDK (latest stable version)
- Dart SDK 3.9.0 or higher
- Git
- Fork and clone the repository
git clone https://github.com/yourusername/flutter_compositions.git
cd flutter_compositions- Install Melos
flutter pub global activate melos- Bootstrap the workspace
melos bootstrap- Verify setup
melos run analyze
melos run test# Run all tests
melos run test
# Test specific package
cd packages/flutter_compositions
flutter test
# Test with coverage
flutter test --coverage# Analyze all packages
melos run analyze
# Run custom lints
dart run custom_lint
# Watch mode
dart run custom_lint --watchcd packages/flutter_compositions/example
flutter runfeature/- New featuresfix/- Bug fixesdocs/- Documentation updatesrefactor/- Code refactoringtest/- Test improvements
Example: feature/add-use-memo or fix/watch-memory-leak
Follow conventional commits format:
<type>(<scope>): <subject>
<body>
<footer>
Types:
feat: New featurefix: Bug fixdocs: Documentation onlystyle: Formatting, missing semicolons, etc.refactor: Code change that neither fixes a bug nor adds a featuretest: Adding or updating testschore: Maintenance tasks
Example:
feat(composables): add useMemo for expensive computations
- Implement useMemo hook for memoizing expensive calculations
- Add comprehensive tests
- Update documentation
Closes #123
- Follow Effective Dart guidelines
- Use
dart formatfor formatting - Run
dart analyzeto check for issues - All public APIs must have documentation comments
- All new features must include tests
- Bug fixes should include regression tests
- Aim for high test coverage (>80%)
- Tests should be deterministic and fast
- Update relevant documentation in
docs/ - Add API documentation for public APIs
- Include examples in documentation
- Update CHANGELOG.md
- Ensure all tests pass
melos run test- Run analysis
melos run analyze
dart run custom_lint- Format code
dart format .- Update documentation
- Add/update API docs
- Update guides if needed
- Update CHANGELOG.md
- Title: Use conventional commit format
- Description:
- Explain what changes were made and why
- Reference related issues
- Include screenshots for UI changes
- Checklist:
- Tests pass
- Analysis passes
- Documentation updated
- CHANGELOG.md updated
- No breaking changes (or clearly documented)
- Maintainers will review your PR
- Address review feedback
- Once approved, a maintainer will merge
When adding a new composable:
- Implement in
packages/flutter_compositions/lib/src/composables/ - Export in
packages/flutter_compositions/lib/src/composables.dart - Test in
packages/flutter_compositions/test/composables/ - Document in
docs/api/composables/ - Example in example app if applicable
Example structure:
/// Brief description of what this composable does.
///
/// More detailed explanation with usage notes.
///
/// Example:
/// ```dart
/// @override
/// Widget Function(BuildContext) setup() {
/// final value = useMyComposable();
/// return (context) => Text('${value.value}');
/// }
/// ```
Ref<T> useMyComposable<T>({
required T initialValue,
}) {
final value = ref(initialValue);
onUnmounted(() {
// Cleanup if needed
});
return value;
}When adding a new lint rule:
- Implement in
packages/flutter_compositions_lints/lib/src/lints/ - Register in
packages/flutter_compositions_lints/lib/flutter_compositions_lints.dart - Test in
packages/flutter_compositions_lints/test/lints/ - Document in
docs/lints/rules.md - Add fixture in
packages/flutter_compositions_lints/test/fixtures/
Include:
- Flutter/Dart version
- Minimal reproduction code
- Expected vs actual behavior
- Stack traces if applicable
Include:
- Use case description
- Proposed API (if applicable)
- Examples of how it would be used
- Comparison with alternatives
flutter_compositions/
├── packages/
│ ├── flutter_compositions/ # Core package
│ │ ├── lib/
│ │ │ ├── src/
│ │ │ │ ├── framework.dart # CompositionWidget
│ │ │ │ ├── compositions.dart # ref, computed, watch
│ │ │ │ ├── composables/ # Built-in composables
│ │ │ │ └── ...
│ │ │ └── flutter_compositions.dart # Main export
│ │ ├── test/ # Tests
│ │ └── example/ # Example app
│ └── flutter_compositions_lints/ # Lint rules package
├── docs/ # Documentation
└── README.md
(Maintainers only)
- Update version in
pubspec.yaml - Update
CHANGELOG.md - Create git tag:
git tag v1.0.0 - Push tag:
git push origin v1.0.0 - GitHub Actions will publish to pub.dev
- Open a GitHub Discussion
- Check existing issues
- Read the documentation
By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to Flutter Compositions! 🎉