Describe the bug
Calling Stripe.instance.collectBankAccount() successfully opens and completes the Stripe bank account collection UI, but after the flow finishes the Flutter app throws a runtime exception:
type 'Null' is not a subtype of type 'Map<String, dynamic>' in type cast
The exception appears to originate from ResultParser.parseError inside the stripe_platform_interface.
This occurs even though the bank account linking flow completes successfully.
To Reproduce
Steps to reproduce the behavior:
- Call
Stripe.instance.collectBankAccount() with a valid clientSecret from the backend.
- Complete the Stripe bank account collection UI.
- After completion, the following exception is thrown.
Example code
final result = await Stripe.instance.collectBankAccount(
clientSecret: model.clientSecret ?? '',
isPaymentIntent: false,
params: CollectBankAccountParams(
paymentMethodType: PaymentMethodType.USBankAccount,
paymentMethodData: CollectBankAccountPaymentMethodData(
billingDetails: BillingDetails(
name: user?.getName(),
email: user?.email,
),
),
),
);
Exception
flutter: type 'Null' is not a subtype of type 'Map<String, dynamic>' in type cast
#0 _$StripeExceptionFromJson (package:stripe_platform_interface/src/models/errors.g.dart:26:23)
#1 new StripeException.fromJson (package:stripe_platform_interface/src/models/errors.dart:44:7)
#2 ResultParser.parseError (package:stripe_platform_interface/src/result_parser.dart:21:28)
#3 ResultParser.parse (package:stripe_platform_interface/src/result_parser.dart:16:13)
#4 MethodChannelStripe.collectBankAccount (package:stripe_platform_interface/src/method_channel_stripe.dart:590:7)
<asynchronous suspension>
#5 Stripe.collectBankAccount (package:flutter_stripe/src/stripe.dart:641:12)
<asynchronous suspension>
Expected behavior
collectBankAccount() should complete without throwing an exception when the bank account collection flow finishes successfully.
Smartphone / tablet
- Device: iOS Simulator and real iOS device (likely reproducible on Android as well)
- OS: iOS (tested on simulator and real device)
- Package version:
flutter_stripe: ^12.3.0
- Flutter version:
3.35.3
Additional context
- The bank account collection UI works correctly.
- The exception occurs after the UI flow completes.
- This seems related to
ResultParser.parseError attempting to parse a null error object into Map<String, dynamic>.
✅ This issue might be caused by null error handling in the platform interface when no error object is returned from native code.
Describe the bug
Calling
Stripe.instance.collectBankAccount()successfully opens and completes the Stripe bank account collection UI, but after the flow finishes the Flutter app throws a runtime exception:The exception appears to originate from
ResultParser.parseErrorinside thestripe_platform_interface.This occurs even though the bank account linking flow completes successfully.
To Reproduce
Steps to reproduce the behavior:
Stripe.instance.collectBankAccount()with a validclientSecretfrom the backend.Example code
Exception
Expected behavior
collectBankAccount()should complete without throwing an exception when the bank account collection flow finishes successfully.Smartphone / tablet
flutter_stripe: ^12.3.03.35.3Additional context
ResultParser.parseErrorattempting to parse anullerror object intoMap<String, dynamic>.✅ This issue might be caused by null error handling in the platform interface when no error object is returned from native code.