Search code examples
iosflutterdart

Flutter Error on Real iOS Device: "module 'fluttertoast' not found"


My flutter app is working properly in iOS Simulator.

I have added fluttertoast by:

  1. Adding it on pubspec.yaml

    dependencies: flutter: sdk: flutter

    cupertino_icons: ^0.1.3

    fluttertoast: ^7.0.1

  2. Importing in my dart file

    import 'package:fluttertoast/fluttertoast.dart';

So far it works as intended. BUT, when I move to a REAL iOS device, my iPhone XS, It won't compile. I get this error:

fatal error: module 'fluttertoast' not found @import fluttertoast;

What am I missing?


Solution

  • Suprisingly, I made it work just now.

    What I did:

    1. Tried to modified the podfile.
    2. Tried to run it. Error due to podfile.
    3. Revert podfile to original state.
    4. Tried to build, pop-up asking something like 'would you like to use Xcode version or version on disk (I used Xcode version before which may have caused the problem)
    5. I chose to use VERSION ON DISK.
    6. Program is now working on real iOS device.

    So whenever you get the pop-up asking "which version to use", always choose "VERSION ON DISK".

    Thanks guys