Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 118c29f

Browse files
author
Michael Klimushyn
authored
[in_app_purchase] Fix most failing pedantic lints (#2317)
None of these fixes should affect functionality. There are dozens of undocumented public API members that still need to be documented to completely remove the analysis_options for this package.
1 parent 2f90d62 commit 118c29f

File tree

12 files changed

+26
-28
lines changed

12 files changed

+26
-28
lines changed

packages/in_app_purchase/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.2.2+3
2+
3+
* Fix failing pedantic lints. None of these fixes should have any change in
4+
functionality.
5+
16
## 0.2.2+2
27

38
* Include lifecycle dependency as a compileOnly one on Android to resolve

packages/in_app_purchase/analysis_options.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,4 @@ include: ../../analysis_options.yaml
77

88
analyzer:
99
errors:
10-
avoid_init_to_null: ignore
11-
prefer_is_empty: ignore
12-
prefer_is_not_empty: ignore
1310
public_member_api_docs: ignore
14-
type_init_formals: ignore
15-
unnecessary_new: ignore
16-
unawaited_futures: ignore

packages/in_app_purchase/example/lib/main.dart

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class _MyAppState extends State<MyApp> {
3636
bool _isAvailable = false;
3737
bool _purchasePending = false;
3838
bool _loading = true;
39-
String _queryProductError = null;
39+
String _queryProductError;
4040

4141
@override
4242
void initState() {
@@ -149,12 +149,12 @@ class _MyAppState extends State<MyApp> {
149149
stack.add(
150150
Stack(
151151
children: [
152-
new Opacity(
152+
Opacity(
153153
opacity: 0.3,
154154
child: const ModalBarrier(dismissible: false, color: Colors.grey),
155155
),
156-
new Center(
157-
child: new CircularProgressIndicator(),
156+
Center(
157+
child: CircularProgressIndicator(),
158158
),
159159
],
160160
),
@@ -213,7 +213,7 @@ class _MyAppState extends State<MyApp> {
213213
title: Text('Products for Sale',
214214
style: Theme.of(context).textTheme.headline));
215215
List<ListTile> productList = <ListTile>[];
216-
if (!_notFoundIds.isEmpty) {
216+
if (_notFoundIds.isNotEmpty) {
217217
productList.add(ListTile(
218218
title: Text('[${_notFoundIds.join(", ")}] not found',
219219
style: TextStyle(color: ThemeData.light().errorColor)),
@@ -375,10 +375,12 @@ class _MyAppState extends State<MyApp> {
375375
}
376376
}
377377
if (Platform.isIOS) {
378-
InAppPurchaseConnection.instance.completePurchase(purchaseDetails);
378+
await InAppPurchaseConnection.instance
379+
.completePurchase(purchaseDetails);
379380
} else if (Platform.isAndroid) {
380381
if (!kAutoConsume && purchaseDetails.productID == _kConsumableId) {
381-
InAppPurchaseConnection.instance.consumePurchase(purchaseDetails);
382+
await InAppPurchaseConnection.instance
383+
.consumePurchase(purchaseDetails);
382384
}
383385
}
384386
}

packages/in_app_purchase/example/test_driver/test/in_app_purchase_e2e_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ Future<void> main() async {
1010
final FlutterDriver driver = await FlutterDriver.connect();
1111
final String result =
1212
await driver.requestData(null, timeout: const Duration(minutes: 1));
13-
driver.close();
13+
await driver.close();
1414
exit(result == 'pass' ? 0 : 1);
1515
}

packages/in_app_purchase/lib/src/billing_client_wrappers/purchase_wrapper.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ class PurchaseWrapper {
101101
@BillingResponseConverter()
102102
class PurchasesResultWrapper {
103103
PurchasesResultWrapper(
104-
{@required BillingResponse this.responseCode,
105-
@required List<PurchaseWrapper> this.purchasesList});
104+
{@required this.responseCode, @required this.purchasesList});
106105

107106
factory PurchasesResultWrapper.fromJson(Map<String, dynamic> map) =>
108107
_$PurchasesResultWrapperFromJson(map);

packages/in_app_purchase/lib/src/in_app_purchase/app_store_connection.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class AppStoreConnection implements InAppPurchaseConnection {
154154
.toList();
155155
}
156156
List<String> invalidIdentifiers = response.invalidProductIdentifiers ?? [];
157-
if (productDetails.length == 0) {
157+
if (productDetails.isEmpty) {
158158
invalidIdentifiers = identifiers.toList();
159159
}
160160
ProductDetailsResponse productDetailsResponse = ProductDetailsResponse(

packages/in_app_purchase/lib/src/in_app_purchase/google_play_connection.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ class GooglePlayConnection
238238
..status = status
239239
..error = error);
240240
}).toList();
241-
if (!purchases.isEmpty) {
241+
if (purchases.isNotEmpty) {
242242
return Future.wait(purchases);
243243
} else {
244244
return [

packages/in_app_purchase/lib/src/in_app_purchase/in_app_purchase_connection.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ class IAPError {
249249
{@required this.source,
250250
@required this.code,
251251
@required this.message,
252-
this.details = null});
252+
this.details});
253253

254254
/// Which source is the error on.
255255
final IAPSource source;

packages/in_app_purchase/lib/src/in_app_purchase/product_details.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ class ProductDetails {
1717
@required this.title,
1818
@required this.description,
1919
@required this.price,
20-
this.skProduct = null,
21-
this.skuDetail = null});
20+
this.skProduct,
21+
this.skuDetail});
2222

2323
/// The identifier of the product, specified in App Store Connect or Sku in Google Play console.
2424
final String id;
@@ -67,9 +67,7 @@ class ProductDetails {
6767
/// A list of [ProductDetails] can be obtained from the this response.
6868
class ProductDetailsResponse {
6969
ProductDetailsResponse(
70-
{@required this.productDetails,
71-
@required this.notFoundIDs,
72-
this.error = null});
70+
{@required this.productDetails, @required this.notFoundIDs, this.error});
7371

7472
/// Each [ProductDetails] uniquely matches one valid identifier in [identifiers] of [InAppPurchaseConnection.queryProductDetails].
7573
final List<ProductDetails> productDetails;

packages/in_app_purchase/lib/src/in_app_purchase/purchase_details.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ class PurchaseDetails {
142142
@required this.productID,
143143
@required this.verificationData,
144144
@required this.transactionDate,
145-
this.skPaymentTransaction = null,
146-
this.billingClientPurchase = null,
145+
this.skPaymentTransaction,
146+
this.billingClientPurchase,
147147
});
148148

149149
/// Generate a [PurchaseDetails] object based on an iOS [SKTransactionWrapper] object.

packages/in_app_purchase/lib/src/store_kit_wrappers/sk_payment_queue_wrapper.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class SKPaymentQueueWrapper {
3535
return _singleton;
3636
}
3737

38-
static final SKPaymentQueueWrapper _singleton = new SKPaymentQueueWrapper._();
38+
static final SKPaymentQueueWrapper _singleton = SKPaymentQueueWrapper._();
3939

4040
SKPaymentQueueWrapper._() {
4141
callbackChannel.setMethodCallHandler(_handleObserverCallbacks);

packages/in_app_purchase/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: in_app_purchase
22
description: A Flutter plugin for in-app purchases. Exposes APIs for making in-app purchases through the App Store and Google Play.
33
author: Flutter Team <flutter-dev@googlegroups.com>
44
homepage: https://github.com/flutter/plugins/tree/master/packages/in_app_purchase
5-
version: 0.2.2+2
5+
version: 0.2.2+3
66

77

88
dependencies:

0 commit comments

Comments
 (0)