flutter barcode scanner not compatible with latest flutter in android build

Troubleshooting

Hi all,

With the latest Flutterflow version 5.1.4 (Flutter 3.27.3), I went to build my application for Android in codemagic and this comes out with the following error:

Upgrading build.gradle

Running Gradle task 'bundleRelease'...

/Users/builder/.pub-cache/git/flutter_barcode_scanner-5aead39ed3becf26898ce4c5dd9af34455187a3d/android/src/main/java/com/amolg/flutterbarcodescanner/FlutterBarcodeScannerPlugin.java:69: error: cannot find symbol

private FlutterBarcodeScannerPlugin(Activity activity, final PluginRegistry.Registrar registrar) {

^

symbol: class Registrar

location: interface PluginRegistry

/Users/builder/.pub-cache/git/flutter_barcode_scanner-5aead39ed3becf26898ce4c5dd9af34455187a3d/android/src/main/java/com/amolg/flutterbarcodescanner/FlutterBarcodeScannerPlugin.java:76: error: cannot find symbol

public static void registerWith(final PluginRegistry.Registrar registrar) {

^

symbol: class Registrar

location: interface PluginRegistry

/Users/builder/.pub-cache/git/flutter_barcode_scanner-5aead39ed3becf26898ce4c5dd9af34455187a3d/android/src/main/java/com/amolg/flutterbarcodescanner/FlutterBarcodeScannerPlugin.java:242: error: cannot find symbol

final PluginRegistry.Registrar registrar,

^

symbol: class Registrar

location: interface PluginRegistry

Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

Note: Some input files use unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

3 errors


From looking into chatgpt and alternatives it comes down to the fact that the PluginRegistry.Registrar class has been deprecated in newer versions of Flutter. The plugin needs to be updated to use the newer embedding API.

Is this known at Flutterflow and when will they release a Barcode scanner that still works? Since the flutter_barcode_scanner (https://pub.dev/packages/flutter_barcode_scanner) seems not be active anymore and has not been updated for 3 years..

What have you tried so far?

I have downgraded some of my gradle settings to no resolve:
pubspecs.yaml collection revert back to 1.19.0 (prev 1.19.1)
android/settings.gradle com.android.application to 7.4
android/settings. gradle kotlin.android to 1.8.10
gradlewrapper.properties distributionUrl to 7.5

Did you check FlutterFlow's Documentation for this topic?
Yes
7
7 replies