Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Cretezy/flutter-format-pre-commit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Note: flutter format is now dart format

Please use dart-format-pre-commit. This package will give a Flutter warning to migrate to dart format, which this other package is.


Flutter Format pre-commit

pre-commit hook for formatting Flutter files.

Add the following in your .pre-commit-config.yaml:

- repo: https://github.com/Cretezy/flutter-format-pre-commit
  rev: "master"
  hooks:
    - id: flutter-format

By default, the flutter format command uses a line length of 80. You can customize what line length is used by passing the --line-length argument to the hook:

- repo: https://github.com/Cretezy/flutter-format-pre-commit
  rev: "master"
  hooks:
    - id: flutter-format
      args: [--line-length=100]

You can also only include/exclude some files (defaults to only .dart, is a pattern):

- repo: https://github.com/Cretezy/flutter-format-pre-commit
  rev: "master"
  hooks:
    - id: flutter-format
      files: lib/* # Only format source files
      exclude: lib/src/avatar.dart # Exclude the avatar widget

Dart

Also see Dart Format pre-commit for formatting only Dart code.

About

Format Flutter code with pre-commit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages