Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.ClassCastException when using CardField #138

Closed
dsling opened this issue Jun 12, 2021 · 1 comment
Closed

java.lang.ClassCastException when using CardField #138

dsling opened this issue Jun 12, 2021 · 1 comment

Comments

@dsling
Copy link

dsling commented Jun 12, 2021

Not sure what I'm doing wrong. I created a new stateful class and added the following:

@override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text('Test Stripe'),
        ),
        body: Container(
          alignment: Alignment.center,
          padding: EdgeInsets.all(16),
          child: CardField(
            onCardChanged: (card) {
              print(card);
            },
          ),
        ));
  }
}

However, when I navigate to the screen, I get the following error:

E/MethodChannel#flutter/platform_views(22645): Failed to handle method call
E/MethodChannel#flutter/platform_views(22645): java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Integer
E/MethodChannel#flutter/platform_views(22645): 	at com.facebook.react.bridge.ReadableMap.getInt(ReadableMap.java:37)
E/MethodChannel#flutter/platform_views(22645): 	at com.reactnativestripesdk.MappersKt.getIntOrNull(Mappers.kt:315)
E/MethodChannel#flutter/platform_views(22645): 	at com.reactnativestripesdk.StripeSdkCardView.setCardStyle(StripeSdkCardView.kt:43)
E/MethodChannel#flutter/platform_views(22645): 	at com.reactnativestripesdk.StripeSdkCardViewManager.setCardStyle(StripeSdkCardViewManager.kt:29)
E/MethodChannel#flutter/platform_views(22645): 	at com.flutter.stripe.StripeSdkCardPlatformView.<init>(StripeSdkCardPlatformView.kt:35)
E/MethodChannel#flutter/platform_views(22645): 	at com.flutter.stripe.StripeSdkCardPlatformViewFactory.create(StripeSdkCardPlatformViewFactory.kt:19)
E/MethodChannel#flutter/platform_views(22645): 	at io.flutter.plugin.platform.PlatformViewsController$1.createAndroidViewForPlatformView(PlatformViewsController.java:146)
E/MethodChannel#flutter/platform_views(22645): 	at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:101)
E/MethodChannel#flutter/platform_views(22645): 	at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:59)
E/MethodChannel#flutter/platform_views(22645): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/MethodChannel#flutter/platform_views(22645): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/MethodChannel#flutter/platform_views(22645): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
E/MethodChannel#flutter/platform_views(22645): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#flutter/platform_views(22645): 	at android.os.MessageQueue.next(MessageQueue.java:335)
E/MethodChannel#flutter/platform_views(22645): 	at android.os.Looper.loop(Looper.java:183)
E/MethodChannel#flutter/platform_views(22645): 	at android.app.ActivityThread.main(ActivityThread.java:7656)
E/MethodChannel#flutter/platform_views(22645): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#flutter/platform_views(22645): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/MethodChannel#flutter/platform_views(22645): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

The on-screen keyboard opens up and I see an empty textbox, but I'm unable to type in it. If I replace the CardField with a standard TextField, I get no errors.

Smartphone / tablet

  • Device: Pixel 4 (emulator)
  • OS: Android 11 (API 30)
  • Package version: 1.0.2
  • Flutter version 2.2.1
@jamesblasco
Copy link
Member

Hello, there is an issue in Flutter that affects the keyboard input and we have been forced to implement it like this. The issue is fixed now on master

We will make the needed changes in our package when the next stable version is released

#14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants