我将 Firebase 软件包更新为最新版本:
firebase_auth: ^0.18.0+1
cloud_firestore: "^0.14.0+2"
firebase_core: "0.5.0"
Run Code Online (Sandbox Code Playgroud)
我还根据这篇文章在我的主要功能中添加了以下内容:
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}
Run Code Online (Sandbox Code Playgroud)
但是当我将应用程序留在模拟器的主屏幕并尝试返回应用程序时,我仍然收到此错误:
[core/no-app] No Firebase App '[DEFAULT]' has been created - call Firebase.initializeApp()
似乎错误是在构建登录页面时引发的,所以这里是:
class LandingPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
AuthService auth = Provider.of<AuthService>(context, listen: false);
return StreamBuilder<UserCustom>(
stream: auth.onAuthStatechanged,
builder: (context, snapshot){
if(snapshot.connectionState == ConnectionState.active){
UserCustom user = snapshot.data;
if(user == null){
return SignInPage.create(context);
}
return JobsScreen();
}else{
return Scaffold(body: Center(child: CircularProgressIndicator(),));
}
},
); …
Run Code Online (Sandbox Code Playgroud) 在学习 Firebase 上的 Flutter 课程时,我尝试重新加载我的模拟器。尽管该应用程序运行良好,但我在调试控制台中收到了一些错误日志:
/EGL_emulation(20277): eglMakeCurrent: 0xe97df060: ver 3 0 (tinfo 0xe4bddba0)
D/eglCodecCommon(20277): setVertexArrayObject: set vao to 0 (0) 1 0
Restarted application in 5?876ms.
Error -32601 received from application: Method not found // HERE
Error -32601 received from application: Method not found // HERE, and
Error -32601 received from application: Method not found // HERE
Error handling 'checkPlatformOverride' custom request: method not available: ext.flutter.platformOverride
Error handling 'serviceExtension' custom request: method not available: ext.flutter.inspector.setPubRootDirectories
Error handling 'checkIsWidgetCreationTracked' custom request: …
Run Code Online (Sandbox Code Playgroud) 我想弄清楚onEdittingComplete
和之间的区别onSubmitted
,我不知道什么时候应该使用后者,因为前者可用于切换焦点或提交表单内容。
我尝试查看文档,但关于该onSubmitted
物业的说法不多。
我必须提一下,我之前没有后端开发经验,我知道之前有人问过关于这个主题的问题,但我需要一个具体的答案。
我想知道是否可以使用 Firebase 身份验证来注册和登录我的用户并将他们的数据存储在 Mongodb 中?
如果是这样,除了“firebase_auth”和 Mangodb 包之外,我还应该学习什么来使其工作?
这可能是显而易见的,但我还是不明白之间的差别throw
,并rethrow
和那些既做时,应使用?