jtmuller5 / flutter-format-pre-commit

Format Flutter code with pre-commit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

License:MIT License


Languages

Language:Shell 100.0%