flutter_stripe
flutter_stripe copied to clipboard
Type cast fails on Customer Sheet cancel
Describe the bug When a Customer Sheet is closed, a type cast error is thrown instead of StripeException
To Reproduce
- Open CustomerSheetScreen
- Init Customer Sheet
- Present Customer Sheet
- Close Customer Sheet by tapping above the sheet or using close button in the top right corner
Expected behavior StripeException with FailureCode.Canceled is thrown
Smartphone / tablet
- Device: Pixel 3
- OS: Android 12
- Package version:
main
branch - Flutter version: 3.19.3
Additional context Logs:
W/ActivityResultRegistry(27246): Dropping pending result for request CustomerSheet: ActivityResult{resultCode=RESULT_OK, data=Intent { (has extras) }}
D/StripeReactNative(27246): com.stripe.android.customersheet.InternalCustomerSheetResult$Canceled cannot be cast to com.stripe.android.view.AddPaymentMethodActivityStarter$Result
[log] type 'String' is not a subtype of type 'Map<String, dynamic>' in type cast
type 'String' is not a subtype of type 'Map<String, dynamic>' in type cast
#0 _$$StripeErrorGenericImplFromJson (package:stripe_platform_interface/src/models/errors.g.dart:13:40)
#1 new _$StripeErrorGenericImpl.fromJson (package:stripe_platform_interface/src/models/errors.freezed.dart:123:7)
#2 _$StripeErrorFromJson (package:stripe_platform_interface/src/models/errors.freezed.dart:18:10)
#3 new StripeError.fromJson (package:stripe_platform_interface/src/models/errors.dart:26:7)
#4 _$$CustomerSheetResultImplFromJson (package:stripe_platform_interface/src/models/customer_sheet.g.dart:131:13)
#5 new _$CustomerSheetResultImpl.fromJson (package:stripe_platform_interface/src/models/customer_sheet.freezed.dart:1024:7)
#6 _$CustomerSheetResultFromJson (package:stripe_platform_interface/src/models/customer_sheet.freezed.dart:855:31)
#7 new CustomerSheetResult.fromJson (package:stripe_platform_interface/src/models/customer_sheet.dart:100:7)
#8 MethodChannelStripe._parseCustomerSheetResult (package:stripe_platform_interface/src/method_channel_stripe.dart:358:36)
#9 MethodChannelStripe.presentCustomerSheet (package:stripe_platform_interface/src/method_channel_stripe.dart:278:12)
<asynchronous suspension>
#10 _CustomerSheetScreenState.confirmCustomerSheet (package:stripe_example/screens/customer_sheet/customer_sheet_screen.dart:119:22)
<asynchronous suspension>
#11 _LoadingButtonState._loadFuture (package:stripe_example/widgets/loading_button.dart:50:7)
<asynchronous suspension>