Parse Issue (Xcode): Module 'fluttertoast' not found (in target 'Toast' from project 'Pods')

Viewed 1706
Parse Issue (Xcode): Module 'fluttertoast' not found
/Users/anand/StudioProjects/untitled/ios/Runner/GeneratedPluginRegistrant.m:11:8

Could not build the application for the simulator.
Error launching application on iPhone 11 Pro.

I trapped this error almost 24 hours. Please help somebody, I used the fluttertoast: ^8.0.9 library maximum places in my project, If I remove the library project runs as usual but if I add the library the above error throws. I don't know how to get rid of the error. I tried most of the answers in the stackoverflow.

import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  
  @override
  Widget build(BuildContext context) {
  
    return Scaffold(
      appBar: AppBar(
        
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'Hello flutter',
            ),
            
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: (){
          Fluttertoast.showToast(
              msg: "This is Center Short Toast",
              toastLength: Toast.LENGTH_SHORT,
              gravity: ToastGravity.CENTER,
              timeInSecForIosWeb: 1,
              backgroundColor: Colors.red,
              textColor: Colors.white,
              fontSize: 16.0
          );
        },
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Please help me how to get rid of the error.

4 Answers

Try this one. It worked for me!

pod repo update
pod install

Try step:

  1. Delete the "podfile" and "podfile. Lock" files in the IOS folder
  2. Terminal execution: execute flutter clean in IOS file directory“
  3. Execute flutter pub get in the ". Yaml" file of Android studio“
  4. Terminal execution: execute pod install in IOS directory“

try installing cocoapod which is dependency manager for swift and objective c and then running command

pod deintegrate
pod install

inside iOS folder in the Flutter project .This should be same for what ever flutter plugin we are going to set up in the project.Please check this link as well macos-deploy-to-ios-devices

I am facing the same problem, first I run the clean:

➜  flutter-netease-music git:(master) ✗ ~/fvm/versions/3.0.5/bin/flutter clean
Cleaning Xcode workspace...                                      1,609ms
Cleaning Xcode workspace...                                      1,957ms
Deleting build...                                                   15ms
Deleting .dart_tool...                                               1ms
Deleting .packages...                                                0ms
Deleting Generated.xcconfig...                                       0ms
Deleting flutter_export_environment.sh...                            0ms
Deleting Flutter.podspec...                                          0ms
Deleting ephemeral...                                                0ms
Deleting .flutter-plugins-dependencies...                            0ms
Deleting .flutter-plugins...                                         0ms

then run the pub get:

~/fvm/versions/3.0.5/bin/flutter pub get

the next step, run this command:

pod repo update
pod install

from the log output, we can found the pod install the fluttertoast dependencies:

➜  ios git:(master) ✗ pod install
Analyzing dependencies
Downloading dependencies
Installing FMDB (2.7.5)
Installing Flutter (1.0.0)
Installing SwiftAudioEx (0.14.7)
Installing Toast (4.0.0)
Installing device_info_plus (0.0.1)
Installing flutter_secure_storage (3.3.1)
Installing fluttertoast (0.0.2)
Installing in_app_purchase_ios (0.0.1)
Installing music_player (0.0.1)
Installing path_provider_ios (0.0.1)
Installing shared_preferences_ios (0.0.1)
Installing sqflite (0.0.2)
Installing system_clock (0.0.1)
Installing url_launcher_ios (0.0.1)
Installing video_player_avfoundation (0.0.1)
Generating Pods project
Integrating client project
Pod installation complete! There are 12 dependencies from the Podfile and 15 total pods installed.

[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` in your build configuration (`Flutter/Release.xcconfig`).

then build the project in xcode success.

Related