diff --git a/analysis_options.yaml b/analysis_options.yaml index 299f057b..a997b3ec 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,4 +1,4 @@ analyzer: strong-mode: - implicit-casts: false + implicit-casts: true implicit-dynamic: false \ No newline at end of file diff --git a/lib/flutter_inapp_purchase.dart b/lib/flutter_inapp_purchase.dart index 5fb22964..faa439a7 100644 --- a/lib/flutter_inapp_purchase.dart +++ b/lib/flutter_inapp_purchase.dart @@ -82,7 +82,7 @@ class FlutterInappPurchase { if (skus == null || skus.contains(null)) return []; skus = skus.toList(); if (Platform.isAndroid) { - dynamic result = await _channel.invokeMethod( + dynamic result = await _channel.invokeMethod( 'getItemsByType', { 'type': _typeInApp[0], @@ -92,7 +92,7 @@ class FlutterInappPurchase { return extractItems(result); } else if (Platform.isIOS) { - dynamic result = await _channel.invokeMethod( + dynamic result = await _channel.invokeMethod( 'getItems', { 'skus': skus, @@ -112,7 +112,7 @@ class FlutterInappPurchase { if (skus == null || skus.contains(null)) return []; skus = skus.toList(); if (Platform.isAndroid) { - dynamic result = await _channel.invokeMethod( + dynamic result = await _channel.invokeMethod( 'getItemsByType', { 'type': _typeInApp[1], @@ -122,7 +122,7 @@ class FlutterInappPurchase { return extractItems(result); } else if (Platform.isIOS) { - dynamic result = await _channel.invokeMethod( + dynamic result = await _channel.invokeMethod( 'getItems', { 'skus': skus, @@ -141,14 +141,14 @@ class FlutterInappPurchase { /// Identical to [getAvailablePurchases] on `iOS`. static Future> getPurchaseHistory() async { if (Platform.isAndroid) { - dynamic result1 = await _channel.invokeMethod( + dynamic result1 = await _channel.invokeMethod( 'getPurchaseHistoryByType', { 'type': _typeInApp[0], }, ); - dynamic result2 = await _channel.invokeMethod( + dynamic result2 = await _channel.invokeMethod( 'getPurchaseHistoryByType', { 'type': _typeInApp[1], @@ -157,7 +157,8 @@ class FlutterInappPurchase { return extractPurchased(result1) + extractPurchased(result2); } else if (Platform.isIOS) { - dynamic result = await _channel.invokeMethod('getAvailableItems'); + dynamic result = + await _channel.invokeMethod('getAvailableItems'); return extractPurchased(json.encode(result)); } @@ -170,14 +171,14 @@ class FlutterInappPurchase { /// This is identical to [getPurchaseHistory] on `iOS` static Future> getAvailablePurchases() async { if (Platform.isAndroid) { - dynamic result1 = await _channel.invokeMethod( + dynamic result1 = await _channel.invokeMethod( 'getAvailableItemsByType', { 'type': _typeInApp[0], }, ); - dynamic result2 = await _channel.invokeMethod( + dynamic result2 = await _channel.invokeMethod( 'getAvailableItemsByType', { 'type': _typeInApp[1], @@ -186,7 +187,8 @@ class FlutterInappPurchase { return extractPurchased(result1) + extractPurchased(result2); } else if (Platform.isIOS) { - dynamic result = await _channel.invokeMethod('getAvailableItems'); + dynamic result = + await _channel.invokeMethod('getAvailableItems'); return extractPurchased(json.encode(result)); } @@ -199,8 +201,8 @@ class FlutterInappPurchase { /// Identical to [buySubscription] on `iOS`. static Future buyProduct(String sku) async { if (Platform.isAndroid) { - dynamic result = - await _channel.invokeMethod('buyItemByType', { + dynamic result = await _channel + .invokeMethod('buyItemByType', { 'type': _typeInApp[0], 'sku': sku, 'oldSku': null, //TODO can this be removed? @@ -211,8 +213,8 @@ class FlutterInappPurchase { return item; } else if (Platform.isIOS) { - dynamic result = await _channel - .invokeMethod('buyProductWithFinishTransaction', { + dynamic result = await _channel.invokeMethod( + 'buyProductWithFinishTransaction', { 'sku': sku, }); result = json.encode(result); @@ -233,8 +235,8 @@ class FlutterInappPurchase { static Future buySubscription(String sku, {String oldSku}) async { if (Platform.isAndroid) { - dynamic result = - await _channel.invokeMethod('buyItemByType', { + dynamic result = await _channel + .invokeMethod('buyItemByType', { 'type': _typeInApp[1], 'sku': sku, 'oldSku': oldSku, @@ -244,8 +246,8 @@ class FlutterInappPurchase { PurchasedItem item = PurchasedItem.fromJSON(param); return item; } else if (Platform.isIOS) { - dynamic result = await _channel - .invokeMethod('buyProductWithFinishTransaction', { + dynamic result = await _channel.invokeMethod( + 'buyProductWithFinishTransaction', { 'sku': sku, }); result = json.encode(result); @@ -300,8 +302,8 @@ class FlutterInappPurchase { static Future buyProductWithoutFinishTransaction( String sku) async { if (Platform.isAndroid) { - dynamic result = - await _channel.invokeMethod('buyItemByType', { + dynamic result = await _channel + .invokeMethod('buyItemByType', { 'type': _typeInApp[0], 'sku': sku, 'oldSku': null, @@ -311,8 +313,8 @@ class FlutterInappPurchase { PurchasedItem item = PurchasedItem.fromJSON(param); return item; } else if (Platform.isIOS) { - dynamic result = await _channel - .invokeMethod('buyProductWithoutFinishTransaction', { + dynamic result = await _channel.invokeMethod( + 'buyProductWithoutFinishTransaction', { 'sku': sku, }); result = json.encode(result); @@ -348,7 +350,7 @@ class FlutterInappPurchase { return List(); } else if (Platform.isIOS) { dynamic result = - await _channel.invokeMethod('getAppStoreInitiatedProducts'); + await _channel.invokeMethod('getAppStoreInitiatedProducts'); return extractItems(json.encode(result)); } diff --git a/pubspec.yaml b/pubspec.yaml index 28bf1a5a..23048409 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -6,7 +6,7 @@ homepage: https://github.com/dooboolab/flutter_inapp_purchase/blob/master/pubspe environment: sdk: '>=1.20.1 <3.0.0' dependencies: - http: '>=0.11.3+16 <1.0.0' + http: '>=0.12.0 <1.0.0' flutter: sdk: flutter