解析问题(Xcode):找不到模块“fluttertoast”(在项目“Pods”的目标“Toast”中)

2024-03-20

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.

我发现这个错误差不多24小时了。请帮助某人,我用过fluttertoast: ^8.0.9库在我的项目中的最大位置,如果我删除库项目照常运行,但如果我添加库,则会引发上述错误。我不知道如何消除该错误。我尝试了 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.
    );
  }
}

请帮助我如何消除该错误。


试试这个。这对我有用!

pod repo update
pod install
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

解析问题(Xcode):找不到模块“fluttertoast”(在项目“Pods”的目标“Toast”中) 的相关文章

随机推荐