Skip to content

[in_app_purchase_store_kit] 'Null check operator used on a null value' is thrown on calling SKPaymentQueueWrapper.transactions(). #143177

Closed
flutter/packages
#6139
@agent515

Description

@agent515

Steps to reproduce

Not entirely sure how to reproduce the error. As it seemed to work for a brief period of time and then started throwing error. Maybe after some failed or pending transactions. (Sandbox Environment)

  • Make a few purchases buyNonConsumable.
  • After some pending or failed transactions, call SKPaymentQueueWrapper().transactions()

Expected results

All previous failed or pending transactions are completed or cleared without any error.

Actual results

Error: Null check operator used on a null value

Code sample

Code sample
 Future finishQueueTransactions() async {
    final transactions = await SKPaymentQueueWrapper().transactions();
    for (final element in transactions) {
      await SKPaymentQueueWrapper().finishTransaction(element);
    }
  }

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
flutter: Null check operator used on a null value
flutter: #0      SKErrorMessage.decode (package:in_app_purchase_storekit/src/messages.g.dart:190:24)
#1      SKPaymentTransactionMessage.decode (package:in_app_purchase_storekit/src/messages.g.dart:111:28)
#2      SKPaymentTransactionMessage.decode (package:in_app_purchase_storekit/src/messages.g.dart:106:41)
#3      _InAppPurchaseAPICodec.readValueOfType (package:in_app_purchase_storekit/src/messages.g.dart:297:44)
#4      StandardMessageCodec.readValue (package:flutter/src/services/message_codecs.dart:477:12)
#5      StandardMessageCodec.readValueOfType (package:flutter/src/services/message_codecs.dart:522:23)
#6      _InAppPurchaseAPICodec.readValueOfType (package:in_app_purchase_storekit/src/messages.g.dart:301:22)
#7      StandardMessageCodec.readValue (package:flutter/src/services/message_codecs.dart:477:12)
#8      StandardMessageCodec.readValueOfType (package:flutter/src/services/message_codecs.dart:522:23)
#9      _InAppPurchaseAPICodec.readValueOfType (package:in_app_purchase_storekit/src/messages.g.dart:301:22)
#10     StandardMessageCodec.readValue (package:flutter/src/services/message_codecs.dart:477:12)
#11     StandardMessageCodec.decodeMessage (package:flutter/src/services/message_codecs.dart:341:28)
#12     BasicMessageChannel.send (package:flutter/src/services/platform_channel.dart:206:18)
<asynchronous suspension>
#13     InAppPurchaseAPI.transactions (package:in_app_purchase_storekit/src/messages.g.dart:357:9)
<asynchronous suspension>
#14     SKPaymentQueueWrapper.transactions (package:in_app_purchase_storekit/src/store_kit_wrappers/sk_payment_queue_wrapper.dart:63:9)

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.16.8, on macOS 14.2 23C64 darwin-arm64, locale en-IN)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.1)
[✓] VS Code (version 1.86.1)
[✓] Connected device (3 available)
[✓] Network resources

! Doctor found issues in 1 category.

Device: iPhone 14 (iOS 17.2.1)

Metadata

Metadata

Assignees

Labels

c: crashStack traces logged to the consolefyi-ecosystemFor the attention of Ecosystem teamp: in_app_purchasePlugin for in-app purchasepackageflutter/packages repository. See also p: labels.platform-iosiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-iosOwned by iOS platform team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions