razorpay / razorpay-flutter-customui

Razorpay Flutter Plugin for Customui
MIT License
6 stars 19 forks source link

NullPointerException when invoking isValidVpa method #82

Open SelvaKumar92 opened 3 days ago

SelvaKumar92 commented 3 days ago

I encountered a NullPointerException when attempting to invoke the isValidVpa method in the Razorpay Flutter plugin. The error occurs when the method is called, resulting in the following stack trace:

E/MethodChannel#razorpay_flutter_customui(13392): Failed to handle method call
E/MethodChannel#razorpay_flutter_customui(13392): java.lang.NullPointerException: Attempt to invoke virtual method 'void com.razorpay.Razorpay.isValidVpa(java.lang.String, com.razorpay.ValidateVpaCallback)' on a null object reference
E/MethodChannel#razorpay_flutter_customui(13392):   at com.razorpay.flutter_customui.RazorpayDelegate.isValidVpa(RazorpayDelegate.java:165)
E/MethodChannel#razorpay_flutter_customui(13392):   at com.razorpay.flutter_customui.RazorpayPlugin.onMethodCall(RazorpayPlugin.java:103)
E/MethodChannel#razorpay_flutter_customui(13392):   at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:258)
E/MethodChannel#razorpay_flutter_customui(13392):   at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/MethodChannel#razorpay_flutter_customui(13392):   at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322)
E/MethodChannel#razorpay_flutter_customui(13392):   at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#razorpay_flutter_customui(13392):   at android.os.Handler.handleCallback(Handler.java:883)
E/MethodChannel#razorpay_flutter_customui(13392):   at android.os.Handler.dispatchMessage(Handler.java:100)
E/MethodChannel#razorpay_flutter_customui(13392):   at android.os.Looper.loop(Looper.java:214)
E/MethodChannel#razorpay_flutter_customui(13392):   at android.app.ActivityThread.main(ActivityThread.java:7682)
E/MethodChannel#razorpay_flutter_customui(13392):   at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#razorpay_flutter_customui(13392):   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516)
E/MethodChannel#razorpay_flutter_customui(13392):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
vivekshindhe commented 2 days ago

@SelvaKumar92 You will need to trigger initilizeSdk("{razorpay_api_key}") function before calling isValidVpa().