Home > other >  Parse Issue (Xcode): Module 'fluttertoast' not found (in target 'Toast' from pro
Parse Issue (Xcode): Module 'fluttertoast' not found (in target 'Toast' from pro

Time:05-24

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.

CodePudding user response:

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“

CodePudding user response:

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

  • Related