iosflutterflutter-add-to-app

Module not found issue with package installed in flutter module (add-to-app)


I have flutter module added to the existing iOS app. Not all but few of the packages installed (via pubspec.yaml file) could not be found by the iOS app when compiled, and I'm getting 'Module not found' error in XCode. Those problematic packages are: razorpay_flutter, google_maps_flutter, webview_flutter, and url_launcher until now. Please have a look at screenshot below:

enter image description here

Same is the case with other 3 packages.

Steps to reproduce issue:

  1. Add razorpay_flutter: ^1.1.3 in the pubspec.yaml file of the flutter module
  2. Run flutter pub get. The package will install
  3. Run Xcode project to which flutter module is added. Got error!

One more thing I observed after step 2, that there is some warning regarding issue for add to existing app:

Running "flutter pub get" in lib_smazing...                         
The plugin `razorpay_flutter` is built using an older version of the Android plugin API which assumes that it's running in a full-Flutter environment. 
It may have undefined behaviors when Flutter is integrated into an existing app as a module.
The plugin can be updated to the v2 Android Plugin APIs by following https://flutter.dev/go/android-plugin-migration.

I guess there is issue with the packages using platform channel/code when added to an existing app, but not sure whether its package-specific issue or a flutter issue with add-to-app.


Solution

  • After few trials and error I found simply running pod install on iOS project directory fixed the issue.