Fix flutter format command

It was removed in 3.12: https://github.com/flutter/flutter/pull/129360
This commit is contained in:
Ian VanSchooten 2024-09-27 14:02:25 -04:00
parent 70b344bbbd
commit 4403fef32e
2 changed files with 7 additions and 4 deletions

View File

@ -3,7 +3,7 @@ DIRS="lib test"
EXIT=0 EXIT=0
for DIR in $DIRS; do for DIR in $DIRS; do
OUT="$(flutter format -l 120 --suppress-analytics "$DIR" | sed -e "s/^Formatted \(.*\)/::error file=$DIR\/\1::Not formatted/g")" OUT="$(dart format -l 120 --suppress-analytics "$DIR" | sed -e "s/^Formatted \(.*\)/::error file=$DIR\/\1::Not formatted/g")"
echo "$OUT" | grep "::error" && EXIT=1 echo "$OUT" | grep "::error" && EXIT=1
done done

View File

@ -32,13 +32,16 @@ If you are having issues with iOS pods, try blowing it all away! `cd ios && rm -
# Formatting # Formatting
`flutter format` can be used to format the code in `lib` and `test` but it's default is 80 char line limit, it's 2020 `dart format` can be used to format the code in `lib` and `test`. We use a line-length of 120 characters.
Use: Use:
```sh ```sh
flutter format lib/ test/ -l 120 dart format lib/ test/ -l 120
``` ```
In Android Studio, set the line length using Preferences -> Editor -> Code Style -> Dart -> Line length, set it to 120. Enable auto-format with Preferences -> Languages & Frameworks -> Flutter -> Format code on save.
# Release # Release
Update `version` in `pubspec.yaml` to reflect this release, then Update `version` in `pubspec.yaml` to reflect this release, then