lefthook_dart 1.0.3
lefthook_dart: ^1.0.3 copied to clipboard
wrapper of lefthook for flutter and dart
lefthook-dart #
A Dart wrapper for Lefthook — the fast and powerful Git hooks manager.
About this project #
This is a community-maintained continuation of the original project-cemetery/lefthook package, which served as a simple Dart CLI wrapper around the Lefthook binary.
The original repository is no longer maintained. This fork updates the tool for modern Dart/Flutter projects, ensuring compatibility, reliability, and ease of use.
For detailed usage and configuration options, refer to the official Lefthook documentation.
Installation #
Step 1: Enable the lefthook command to run from any place in your terminal #
If you already have the original Lefthook installed, you will need to uninstall it, as it may cause conflicts.
flutter pub global activate lefthook_dart
This will ensure that the lefthook command uses lefthook_dart, a Dart-based wrapper around original Lefthook.
Step 2: The first run of lefthook will download lefthook and execute lefthook install automatically #
lefthook
Step 3: Change lefthook.yml in root of your project. #
# lefthook.yml
pre-commit:
commands:
prettify:
glob: "*.dart"
run: dart format {all_files}
Step 4: Test hook manually (optional) #
lefthook run pre-commit
Step 5: To uninstall (optional) #
flutter pub global deactivate lefthook_dart
If you are using Melos #
###############################################
## GIT HOOK COMMANDS ##
###############################################
hooks:install:
run: flutter pub global activate lefthook_dart && lefthook
hooks:uninstall:
run: flutter pub global deactivate lefthook_dart
hooks:run:
run: lefthook run pre-commit