Simply use this package instead
flutter_barcode_scanner_plus: ^3.0.8
it handles newer Flutter versions & device compatibility better. Save yourself the debugging headache!