Overview
git_hooks is a Dart-based tool that integrates Git hooks into Flutter projects, enabling automated checks before commits and pushes. It helps prevent bad code from being committed by running custom scripts at key points in the Git workflow—such as pre-commit, pre-push, and post-merge. Inspired by husky, it provides a seamless way to enforce code quality, formatting, and testing standards directly within the development environment. The package supports multiple platforms including Android, iOS, macOS, Windows, and Linux, making it ideal for cross-platform teams.
Use cases
- Enforce code formatting before commit
- Run tests before pushing
- Prevent accidental commits of untested code
- Automate linting on pre-commit
- Ensure consistent project setup across team members
Key features
- Supports pre-commit, pre-push, and post-merge hooks
- Runs Dart scripts during Git events
- Cross-platform compatibility
- Easy integration via Flutter pub
- Configurable hook execution
Suitable for
- Flutter developers using Git
- Teams enforcing code quality
- CI/CD pipeline preparatory steps
- Projects requiring consistent commit hygiene
- Developers migrating from husky to Dart
Considerations
- Requires manual setup of hook scripts
- May need adjustments for complex workflows
- Not compatible with all Git configurations
- Depends on correct file permissions
- Limited documentation compared to mature alternatives