[英]MissingPluginException (MissingPluginException(No implementation found for method Firebase#initializeCore on channel plugins.flutter.io/firebase_core)
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:todo_firebase/auth/authscreen.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:todo_firebase/screens/home.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
//initilization of Firebase app
// other Firebase service initialization
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: StreamBuilder(
stream: FirebaseAuth.instance.authStateChanges(),
builder: (context, usersnapshot) {
if (usersnapshot.hasData) {
return Home();
} else {
return AuthScreen();
}
},
),
debugShowCheckedModeBanner: false,
theme: ThemeData(brightness: Brightness.light, primaryColor: Colors.blue),
// ignore: dead_code
);
}
}
This is my main.dart code.这是我的 main.dart 代码。 I get the following output at 'await Firebase.initializeApp()': MissingPluginException (MissingPluginException(No implementation found for method Firebase#initializeCore on channel plugins.flutter.io/firebase_core))我在'await Firebase.initializeApp()'得到以下输出: MissingPluginException (MissingPluginException(No implementation found for method Firebase#initializeCore on channel plugins.flutter.io/firebase_core))
I'm trying to make a daily task app but whenever I execute it using VSCode, it builds a Windows Application that appears blank.我正在尝试制作一个日常任务应用程序,但每当我使用 VSCode 执行它时,它都会构建一个显示为空白的 Windows 应用程序。 I've written the whole code in the different sections of lib (authentication and homepage), main.dart, and pubspec.yaml but it is not executing.我已经在 lib(身份验证和主页)、main.dart 和 pubspec.yaml 的不同部分编写了整个代码,但它没有执行。 Kindly provide the method to fix the error, and make my app work.请提供修复错误的方法,并使我的应用程序正常工作。
Had this issue this morning.. What a problem it was!今天早上有这个问题..这是一个多么大的问题! Took me a few hours to figure out.我花了几个小时才弄清楚。 Everything is working now though!不过现在一切正常!
What did I do?我做了什么? I tried cleaning my project out, deleted ios file and ran flutter create .
我尝试清理我的项目,删除 ios 文件并运行flutter create .
a few times with no luck... Pulled my hair out!几次都没有运气......把我的头发拉了出来!
What fixed it?什么修好了?
run flutter clean
inside your project and then run flutter pub cache repair
在你的项目中运行flutter clean
,然后运行flutter pub cache repair
Then you need to manually update your pubspec.yaml with the latest version of firebase core, etc. Yes make sure you delete lock file first then manually update the dependencies.然后您需要使用最新版本的 firebase 核心等手动更新您的 pubspec.yaml。是的,请确保先删除锁定文件,然后手动更新依赖项。 DO NOT run flutter pub upgrade
.不要运行flutter pub upgrade
。 Won't work.. Just manually add them in :(行不通..只需手动添加它们:(
This is what I manually added into my pubspec.yaml:这是我手动添加到我的 pubspec.yaml 中的:
cloud_firestore: ^3.2.1
firebase_core: ^1.19.1
firebase_storage: ^10.3.1
firebase_auth: ^3.4.1
firebase_messaging: ^11.4.4
First of all your app is not running on device If running then stop it and then Fire these command Flutter clean
Then Flutter pub get
首先你的应用程序没有在设备上运行如果运行然后停止它然后触发这些命令Flutter clean
然后Flutter pub get
Then run your project然后运行你的项目
There seems to be a problem with the latest firebase_core version 1.19.0 Try to use the previous version:最新的firebase_core 1.19.0版本好像有问题尝试使用之前的版本:
firebase_core: ^1.18.0
At least this solved the problem for me.至少这为我解决了问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.