Skip to content

Commit 988a989

Browse files
committed
ci: fix format & ignore generated types
1 parent 518a1dc commit 988a989

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ jobs:
2323

2424
- run: flutter pub get
2525

26-
- run: dart format --page-width 80 --trailing-commas automate --output=none --set-exit-if-changed .
26+
- name: Check formatting (excluding generated files)
27+
run: |
28+
git ls-files '*.dart' \
29+
| grep -v '^lib/types.dart$' \
30+
| xargs dart format --page-width 80 --output=none --set-exit-if-changed
2731
2832
# - run: flutter analyze .
2933

CLAUDE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ final allPurchases = await iap.getAvailablePurchases(
5959

6060
Before committing any changes, run these commands in order and ensure ALL pass:
6161

62-
1. **Format check**: `dart format --set-exit-if-changed .`
63-
- This will fail if any files need formatting (exit code 1)
64-
- If it fails, run `dart format .` to fix formatting, then retry
62+
1. **Format check**: `git ls-files '*.dart' | grep -v '^lib/types.dart$' | xargs dart format --page-width 80 --output=none --set-exit-if-changed`
63+
- This matches the CI formatter and skips the generated `lib/types.dart`
64+
- If it fails, run the same command without `--set-exit-if-changed` (or drop the `--output` flag) to auto-format, then retry
6565
- Always format code before committing to maintain consistent style
6666
2. **Lint check**: `flutter analyze`
6767
- Fix any lint issues before committing

lib/builders.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,7 @@ class RequestSubscriptionBuilder {
198198
return this;
199199
}
200200

201-
RequestSubscriptionBuilder withAndroid(
202-
AndroidSubscriptionBuilder configure) {
201+
RequestSubscriptionBuilder withAndroid(AndroidSubscriptionBuilder configure) {
203202
configure(android);
204203
return this;
205204
}

lib/flutter_inapp_purchase.dart

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,9 @@ extension PurchaseLegacyCompat on iap_types.Purchase {
9595
? (this as iap_types.PurchaseIOS).quantityIOS
9696
: null;
9797

98-
String? get originalTransactionIdentifierIOS =>
99-
this is iap_types.PurchaseIOS
100-
? (this as iap_types.PurchaseIOS).originalTransactionIdentifierIOS
101-
: null;
98+
String? get originalTransactionIdentifierIOS => this is iap_types.PurchaseIOS
99+
? (this as iap_types.PurchaseIOS).originalTransactionIdentifierIOS
100+
: null;
102101

103102
double? get originalTransactionDateIOS => this is iap_types.PurchaseIOS
104103
? (this as iap_types.PurchaseIOS).originalTransactionDateIOS
@@ -172,8 +171,7 @@ extension ProductSubscriptionLegacyCompat on iap_types.ProductSubscription {
172171
return null;
173172
}
174173

175-
List<iap_types.AndroidSubscriptionOfferInput>?
176-
get subscriptionOffersAndroid {
174+
List<iap_types.AndroidSubscriptionOfferInput>? get subscriptionOffersAndroid {
177175
if (this is iap_types.ProductSubscriptionAndroid) {
178176
final details = (this as iap_types.ProductSubscriptionAndroid)
179177
.subscriptionOfferDetailsAndroid;
@@ -526,8 +524,8 @@ class FlutterInappPurchase
526524
}
527525

528526
final requestVariant = effectiveProps.request;
529-
final isSubscription = requestVariant
530-
is iap_types.RequestPurchasePropsRequestSubscription;
527+
final isSubscription =
528+
requestVariant is iap_types.RequestPurchasePropsRequestSubscription;
531529

532530
try {
533531
if (_platform.isIOS) {

0 commit comments

Comments
 (0)