Monkey.D Amith
Monkey.D Amith

Reputation: 47

How to fix 'cannot find symbol' error for Registrar in Razorpay_Flutter plugin on Flutter 3.29.0?

I'm using the razorpay_flutter plugin in my Flutter project, but when I try to build the app, I get the following error:

error: cannot find symbol  
import io.flutter.plugin.common.PluginRegistry.Registrar;  
                                              ^  
symbol:   class Registrar  
location: interface PluginRegistry  

It seems that Registrar is no longer supported in newer Flutter versions (I'm using Flutter 3.29.0). I've tried updating the plugin and modifying the code, but the issue persists.

How can I fix this error and make the plugin compatible with the latest Flutter version?

I tried the following to fix the issue:

  1. Upgrading the plugin – I updated razorpay_flutter to 1.3.9, but it is not available yet.
  2. Using Flutter clean – Ran flutter clean and flutter pub get, but the issue persisted.
  3. Checking Flutter version – I'm using Flutter 3.29.0, which no longer supports Registrar.
  4. Manually modifying the plugin files – Replaced Registrar with FlutterPlugin, but it caused more errors.

I expected the project to build successfully after updating dependencies or making changes, but the error still appears. How can I resolve this in Flutter 3.29.0?

Upvotes: 2

Views: 82

Answers (2)

Leo
Leo

Reputation: 121

New package version has been released: https://pub.dev/packages/razorpay_flutter/changelog

You can fix it by upgrading the package version to v1.4.0

Upvotes: 3

Daren
Daren

Reputation: 51

It looks like the official package hasn’t been updated for Flutter v2 Android embedding yet. As a workaround, you can use this fork:

razorpay_flutter:
  git:
    url: https://github.com/nikb7/razorpay-flutter.git
    ref: fluuter-v1-embedding

This should work until the package maintainers update the official version. Hope that helps!

Upvotes: 2

Related Questions