Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MissingPluginException(No implementation found for method open on channel razorpay_flutter)

Reloaded 7 of 542 libraries in 1,099ms.
E/flutter ( 1062): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method open on channel razorpay_flutter)
[38;5;244mE/flutter ( 1062): #0      MethodChannel.invokeMethod[39;49m
E/flutter ( 1062): <asynchronous suspension>
[38;5;248mE/flutter ( 1062): #1      Razorpay.open    (package:razorpay_flutter/razorpay_flutter.dart:48:35)[39;49m
[38;5;248mE/flutter ( 1062): #2      _BuyBidsState.openCheckout[39;49m
[38;5;248mE/flutter ( 1062): #3      _BuyBidsState.getBidsData.<anonymous closure>[39;49m
[38;5;244mE/flutter ( 1062): #4      _InkResponseState._handleTap[39;49m
[38;5;244mE/flutter ( 1062): #5      _InkResponseState.build.<anonymous closure>[39;49m        
[38;5;244mE/flutter ( 1062): #6      GestureRecognizer.invokeCallback[39;49m
[38;5;244mE/flutter ( 1062): #7      TapGestureRecognizer.handleTapUp[39;49m
[38;5;244mE/flutter ( 1062): #8      BaseTapGestureRecognizer._checkUp[39;49m
[38;5;244mE/flutter ( 1062): #9      BaseTapGestureRecognizer.acceptGesture[39;49m
[38;5;244mE/flutter ( 1062): #10     GestureArenaManager.sweep[39;49m
[38;5;244mE/flutter ( 1062): #11     GestureBinding.handleEvent[39;49m
[38;5;244mE/flutter ( 1062): #12     GestureBinding.dispatchEvent[39;49m
[38;5;244mE/flutter ( 1062): #13     GestureBinding._handlePointerEvent[39;49m
[38;5;244mE/flutter ( 1062): #14     GestureBinding._flushPointerEventQueue[39;49m
[38;5;244mE/flutter ( 1062): #15     GestureBinding._handlePointerDataPacket[39;49m
[38;5;244mE/flutter ( 1062): #16     _rootRunUnary  (dart:async/zone.dart:1138:13)[39;49m
[38;5;244mE/flutter ( 1062): #17     _CustomZone.runUnary  (dart:async/zone.dart:1031:19)    [39;49m
[38;5;244mE/flutter ( 1062): #18     _CustomZone.runUnaryGuarded  (dart:async/zone.dart:933:7)[39;49m
[38;5;244mE/flutter ( 1062): #19     _invoke1  (dart:ui/hooks.dart:273:10)[39;49m
[38;5;244mE/flutter ( 1062): #20     _dispatchPointerDataPacket  (dart:ui/hooks.dart:182:5)[39;49m
E/flutter ( 1062):

I am getting this error while integrating the razorpay with flutter.I have written the code correctly or not.

  @override
  void initState() {
  super.initState();

 _razorpay = Razorpay();
 _razorpay.on(Razorpay.EVENT_PAYMENT_SUCCESS, _handlePaymentSuccess);
 _razorpay.on(Razorpay.EVENT_PAYMENT_ERROR, _handlePaymentError);
 _razorpay.on(Razorpay.EVENT_EXTERNAL_WALLET, _handleExternalWallet);
}

@override
void dispose() {
super.dispose();
_razorpay.clear();
}

 void openCheckout() async {
 var options = {
  'key': 'rzp_test_geinuADCB6Csdb',
  'amount': 10*100,
  'name': 'BidAnd2Win',
  'description': 'Buying Bid to play game',
  'prefill': {'contact': '8888888888', 'email': '[email protected]'},
  'external': {
    'wallets' : ['paytm'],
  }
 };
try{
 _razorpay.open(options);
}
catch(e) {
  debugPrint(e);
}

}

void _handlePaymentSuccess(PaymentSuccessResponse response) {
  Fluttertoast.showToast(msg: 'Success' + response.paymentId);
}

void _handlePaymentError(PaymentFailureResponse response) {
  Fluttertoast.showToast(msg: 'Failure' + response.code.toString() + " - " + response.message);
}

void _handleExternalWallet(ExternalWalletResponse response) {
  Fluttertoast.showToast(msg: 'Sucess Wallet payment' + response.walletName);
}

At first i am getting error when initState() is called for all these three methods [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method open on channel razorpay_flutter)

then for second method

[ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method resync on channel razorpay_flutter)

and for the third method

[ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method resync on channel razorpay_flutter)

I have also added my razorpay_flutter correctly but when I click the button and call the method openCheckout() then missingPluginException occurs. How to fix this unhandled Exception error i have already called _razorpay.open(options) in try and catch block

like image 610
Divyanshu Bhaskar Avatar asked Apr 03 '26 00:04

Divyanshu Bhaskar


2 Answers

flutter clean, and restart, then it ok

I found it at: enter link description here and it worked fore me just fine.

like image 80
Meir Avatar answered Apr 04 '26 14:04

Meir


I have faced same issue on another flutter package. The main reason of issue that after PUB GET new package, what use MethodChannels, you need to do next steps:

Uninstall the app from your device. Rebuild app again. This should solve the issue.

like image 34
Murat Kurbanov Avatar answered Apr 04 '26 15:04

Murat Kurbanov