Answer the question
In order to leave comments, you need to log in
Why doesn't pre-commit autoformater flutter work?
I use the flutter-format-pre-commit library to automatically format code before commit.
In the .pre-commit-config.yaml file, I specified the start file of the application for testing the functionality of the hook
- repo: https://github.com/Cretezy/flutter-format-pre-commit
rev: "master"
hooks:
- id: flutter-format
files: lib/src/app.dart # Only format source file
Commit failed with error
0 files committed, 1 file failed to commit: test hook
Format Flutter Code......................................................Failed
hookid: flutter-format
Files were modified by this hook. Additional output:
Formatted lib/src/app.dart
find: ‘> bin [’: No such file or directory
Answer the question
In order to leave comments, you need to log in
put https://pre-commit.com/
run:
pre-commit install
git add .pre-commit-config.yaml
config file:
- repo: local
hooks:
- id: flutter-format-lib
name: format-lib
entry: dartfmt -l 150 -w lib
language: system
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question