From 1f208aa26454fb4debdfd1ebed9ee0d918b93c9a Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Wed, 30 Aug 2023 10:38:04 -0700 Subject: [PATCH] [in_app_purchase] Minor lint cleanup (#4818) Updates some lints for current versions of Flutter, reducing the need for `// ignore`s. Fixes https://github.com/flutter/flutter/issues/131792 --- packages/in_app_purchase/in_app_purchase/CHANGELOG.md | 4 ++++ .../in_app_purchase/in_app_purchase/example/lib/main.dart | 6 ++---- packages/in_app_purchase/in_app_purchase/pubspec.yaml | 2 +- .../in_app_purchase/in_app_purchase_android/CHANGELOG.md | 4 ++++ .../in_app_purchase_android/example/lib/main.dart | 8 ++------ .../src/in_app_purchase_android_platform_addition.dart | 1 - .../in_app_purchase/in_app_purchase_android/pubspec.yaml | 2 +- .../test/in_app_purchase_platform_test.dart | 7 ------- .../in_app_purchase/in_app_purchase_storekit/CHANGELOG.md | 4 ++++ .../in_app_purchase_storekit/example/lib/main.dart | 6 ++---- .../src/in_app_purchase_storekit_platform_addition.dart | 3 +-- .../in_app_purchase/in_app_purchase_storekit/pubspec.yaml | 2 +- .../test/fakes/fake_storekit_platform.dart | 2 -- 13 files changed, 22 insertions(+), 29 deletions(-) diff --git a/packages/in_app_purchase/in_app_purchase/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase/CHANGELOG.md index e162a3366633..652ebc3b46e5 100644 --- a/packages/in_app_purchase/in_app_purchase/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.1.10 + +* Updates example code for current versions of Flutter. + ## 3.1.9 * Adds pub topics to package metadata. diff --git a/packages/in_app_purchase/in_app_purchase/example/lib/main.dart b/packages/in_app_purchase/in_app_purchase/example/lib/main.dart index 5a030e8fbe40..5afb52ac99ea 100644 --- a/packages/in_app_purchase/in_app_purchase/example/lib/main.dart +++ b/packages/in_app_purchase/in_app_purchase/example/lib/main.dart @@ -164,10 +164,8 @@ class _MyAppState extends State<_MyApp> { } if (_purchasePending) { stack.add( - // TODO(goderbauer): Make this const when that's available on stable. - // ignore: prefer_const_constructors - Stack( - children: const [ + const Stack( + children: [ Opacity( opacity: 0.3, child: ModalBarrier(dismissible: false, color: Colors.grey), diff --git a/packages/in_app_purchase/in_app_purchase/pubspec.yaml b/packages/in_app_purchase/in_app_purchase/pubspec.yaml index 813c57aa0648..ba95a32125a5 100644 --- a/packages/in_app_purchase/in_app_purchase/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase/pubspec.yaml @@ -2,7 +2,7 @@ name: in_app_purchase description: A Flutter plugin for in-app purchases. Exposes APIs for making in-app purchases through the App Store and Google Play. repository: https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22 -version: 3.1.9 +version: 3.1.10 environment: sdk: ">=2.19.0 <4.0.0" diff --git a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md index d783d5f91d92..88ddaca8ca0c 100644 --- a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.0+13 + +* Updates example code for current versions of Flutter. + ## 0.3.0+12 * Adds pub topics to package metadata. diff --git a/packages/in_app_purchase/in_app_purchase_android/example/lib/main.dart b/packages/in_app_purchase/in_app_purchase_android/example/lib/main.dart index 462260b4bef7..6377d2dc5754 100644 --- a/packages/in_app_purchase/in_app_purchase_android/example/lib/main.dart +++ b/packages/in_app_purchase/in_app_purchase_android/example/lib/main.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// ignore_for_file: avoid_print - import 'dart:async'; import 'package:flutter/material.dart'; @@ -156,10 +154,8 @@ class _MyAppState extends State<_MyApp> { } if (_purchasePending) { stack.add( - // TODO(goderbauer): Make this const when that's available on stable. - // ignore: prefer_const_constructors - Stack( - children: const [ + const Stack( + children: [ Opacity( opacity: 0.3, child: ModalBarrier(dismissible: false, color: Colors.grey), diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform_addition.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform_addition.dart index eb58d1536c20..e3050f8888bc 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform_addition.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform_addition.dart @@ -22,7 +22,6 @@ class InAppPurchaseAndroidPlatformAddition /// this is handled internally and the [enablePendingPurchase] property will /// always return `true`. /// - // ignore: deprecated_member_use_from_same_package /// See also [enablePendingPurchases] for more on pending purchases. @Deprecated( 'The requirement to call `enablePendingPurchases()` has become obsolete ' diff --git a/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml index c4675ed6ab82..d9e4e09fb229 100644 --- a/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml @@ -2,7 +2,7 @@ name: in_app_purchase_android description: An implementation for the Android platform of the Flutter `in_app_purchase` plugin. This uses the Android BillingClient APIs. repository: https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22 -version: 0.3.0+12 +version: 0.3.0+13 environment: sdk: ">=2.19.0 <4.0.0" diff --git a/packages/in_app_purchase/in_app_purchase_platform_interface/test/in_app_purchase_platform_test.dart b/packages/in_app_purchase/in_app_purchase_platform_interface/test/in_app_purchase_platform_test.dart index 879ad9c4c633..0a79e99041d6 100644 --- a/packages/in_app_purchase/in_app_purchase_platform_interface/test/in_app_purchase_platform_test.dart +++ b/packages/in_app_purchase/in_app_purchase_platform_interface/test/in_app_purchase_platform_test.dart @@ -33,7 +33,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of purchaseStream should throw unimplemented error', () { final ExtendsInAppPurchasePlatform inAppPurchasePlatform = @@ -46,7 +45,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of isAvailable should throw unimplemented error', () { final ExtendsInAppPurchasePlatform inAppPurchasePlatform = @@ -59,7 +57,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of queryProductDetails should throw unimplemented error', () { final ExtendsInAppPurchasePlatform inAppPurchasePlatform = @@ -72,7 +69,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of buyNonConsumable should throw unimplemented error', () { final ExtendsInAppPurchasePlatform inAppPurchasePlatform = @@ -87,7 +83,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of buyConsumable should throw unimplemented error', () { final ExtendsInAppPurchasePlatform inAppPurchasePlatform = @@ -102,7 +97,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of completePurchase should throw unimplemented error', () { final ExtendsInAppPurchasePlatform inAppPurchasePlatform = @@ -115,7 +109,6 @@ void main() { }); test( - // ignore: lines_longer_than_80_chars 'Default implementation of restorePurchases should throw unimplemented error', () { final ExtendsInAppPurchasePlatform inAppPurchasePlatform = diff --git a/packages/in_app_purchase/in_app_purchase_storekit/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase_storekit/CHANGELOG.md index b89877afd740..82a5de827a91 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase_storekit/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.6+7 + +* Updates example code for current versions of Flutter. + ## 0.3.6+6 * Adds pub topics to package metadata. diff --git a/packages/in_app_purchase/in_app_purchase_storekit/example/lib/main.dart b/packages/in_app_purchase/in_app_purchase_storekit/example/lib/main.dart index 9072bab499be..cab8ddf0c2db 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/example/lib/main.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/example/lib/main.dart @@ -156,10 +156,8 @@ class _MyAppState extends State<_MyApp> { } if (_purchasePending) { stack.add( - // TODO(goderbauer): Make this const when that's available on stable. - // ignore: prefer_const_constructors - Stack( - children: const [ + const Stack( + children: [ Opacity( opacity: 0.3, child: ModalBarrier(dismissible: false, color: Colors.grey), diff --git a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform_addition.dart b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform_addition.dart index b467b89b68a9..3b88aacc16e9 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform_addition.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform_addition.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// ignore_for_file: avoid_print - import 'package:in_app_purchase_platform_interface/in_app_purchase_platform_interface.dart'; import '../in_app_purchase_storekit.dart'; @@ -31,6 +29,7 @@ class InAppPurchaseStoreKitPlatformAddition serverVerificationData: receipt, source: kIAPSource); } catch (e) { + // ignore: avoid_print print( 'Something is wrong while fetching the receipt, this normally happens when the app is ' 'running on a simulator: $e'); diff --git a/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml index dbdf4cb84afb..46ab2f20159b 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml @@ -2,7 +2,7 @@ name: in_app_purchase_storekit description: An implementation for the iOS and macOS platforms of the Flutter `in_app_purchase` plugin. This uses the StoreKit Framework. repository: https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase_storekit issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22 -version: 0.3.6+6 +version: 0.3.6+7 environment: sdk: ">=2.19.0 <4.0.0" diff --git a/packages/in_app_purchase/in_app_purchase_storekit/test/fakes/fake_storekit_platform.dart b/packages/in_app_purchase/in_app_purchase_storekit/test/fakes/fake_storekit_platform.dart index 010e4f4c99f5..6ae002c82517 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/test/fakes/fake_storekit_platform.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/test/fakes/fake_storekit_platform.dart @@ -163,8 +163,6 @@ class FakeStoreKitPlatform { return Future.sync(() {}); case '-[InAppPurchasePlugin retrieveReceiptData:result:]': if (receiptData != null) { - // TODO(asashour): Remove the `ignore` when Dart 3 reaches stable. - // ignore: unnecessary_null_checks return Future.value(receiptData!); } else { throw PlatformException(code: 'no_receipt_data');