I am trying to run a Flutter app on iOS device after some time but the project is failing to build for iOS.
The error that I am getting is happening in the "GeneratedPluginRegistrant.h" file and is as follows:
#import "GeneratedPluginRegistrant.h"
#if __has_include(<flutter_barcode_scanner/SwiftFlutterBarcodeScannerPlugin.h>)
#import <flutter_barcode_scanner/SwiftFlutterBarcodeScannerPlugin.h>
#else
@import flutter_barcode_scanner; /* ERROR: Module 'flutter_barcode_scanner' not found */
#endif
My pubspec.yaml content are as follows:
name: test_app
description: A new Flutter project.
publish_to: "none" # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: ">=2.17.6 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_speed_dial: ^6.2.0
flutter_barcode_scanner: ^2.0.0
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/playstore_icon.png"
min_sdk_android: 29
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: ^0.10.0
flutter_lints: ^2.0.0
flutter:
uses-material-design: true
assets:
- assets/
- assets/illustrations/
There is no issue with my Flutter as outputted by flutter doctor command as follows:
[✓] Flutter (Channel stable, 3.3.8, on macOS 12.6 21G115 darwin-arm, locale
en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.74.3)
[✓] Connected device (3 available)
[✓] HTTP Host Availability
• No issues found!
To resolve the issue I tried the following commands first:
flutter clean
flutter pub get
But the issue still persisted. Then I used the following steps to resolve the issue:
Step 1: Deleted the iOS folder in the project.
Step 2: Used the commands in terminal as follows -
flutter create -i swift .
flutter clean
flutter pub get
The issue still persisted and the build failed with the same error as above.
Not quite sure now how to resolve this. Can anyone please help?
Thanks in advance!