Open dereking opened 1 month ago
did you add flutter_stripe_web to you dependencies? I cannot reproduce it on our example app which has identical code
Yes, I added flutter_stripe_web to my dependencies yet.
It looks like the issue is provoked by web hot reload after a added flutter_stripe_web . I restart flutter run -d chrome
, It works. But i think I should test more on iOS and Android..
Latest found:
I found that flutter-stripe
depends on stripe_platform_interface: ^11.1.1
But stripe_platform_interface
dosn't support web... only support Android\iOS\Linux\macOS\Windows.
The source code caused error is : stripe_platform_interface-11.1.1/lib/src/method_channel_stripe.dart 672:33 create
class MethodChannelStripeFactory {
const MethodChannelStripeFactory();
StripePlatform create() => MethodChannelStripe(
methodChannel: const MethodChannel(
'flutter.stripe/payments',
JSONMethodCodec(),
),
platformIsIos: Platform.isIOS, <--------cause error: DartError: Unsupported operation: Platform._operatingSystem
platformIsAndroid: Platform.isAndroid,
);
}
the problem is "Platform". We need to add web support in this method:
StripePlatform create() => MethodChannelStripe(
methodChannel: const MethodChannel(
'flutter.stripe/payments',
JSONMethodCodec(),
),
platformIsIos: !kIsWeb && Platform.isIOS,
platformIsAndroid: !kIsWeb && Platform.isAndroid,
);
Hope can help.
Describe the bug
On web , this initialization thrown excception: initialization error on web, throw "DartError: Unsupported operation: Platform._operatingSystem"
To Reproduce Steps to reproduce the behavior:
Expected behavior Console displays the error in vscode terminal.
Smartphone / tablet