简体   繁体   English

如何将 Firebase 连接到 Flutter 应用程序?

[英]How can i connect firebase to flutter app?

please help me connect firebase to my flutter application.请帮助我将 firebase 连接到我的颤振应用程序。 When I asked this question, I found information on the internet https://firebase.flutter.dev/docs/overview/ .当我问这个问题时,我在互联网上找到了信息https://firebase.flutter.dev/docs/overview/ But I didn't understand anything since the second step, help me please.但是从第二步开始我什么都不明白,请帮助我。

Install the plugin by running the following command from your project root directory:通过从项目根目录运行以下命令来安装插件:

$ flutter pub get.
  1. Create Firebase project Firebase console创建 Firebase 项目Firebase 控制台

You will have to enter project name, account, choose the coutry etc.您必须输入项目名称、帐户、选择国家等。

  1. After you create your project, choose the desired platform that you want to use firebase on (Android in this case) Register App on firebase创建项目后,选择要在其上使用 firebase 的所需平台(在本例中为 Android) 在 firebase 上注册应用程序

  2. Then you register your application, by writing your applicationId in the required form然后您注册您的应用程序,通过以所需的形式写入您的 applicationId

This is where your apllicationId is located --> AplicationId location这是您的应用程序ID 所在的位置-->应用程序 ID 位置

  1. Download google-services.json and put it in the App folder (Nicely shown on the firebase webpage)下载 google-services.json 并将其放在 App 文件夹中(很好地显示在 firebase 网页上)

  2. Then you will have to make some changes to gradle files I think (it's nicely shown on firebase page, nothing exceptionally hard)然后你将不得不对我认为的 gradle 文件进行一些更改(它很好地显示在 firebase 页面上,没什么特别难的)

  3. You add firebase to your pubspec.yaml file ( firebase_core: "Version that you want")您将 firebase 添加到您的 pubspec.yaml 文件( firebase_core: "Version that you want")

  4. run $ flutter pub get运行$ flutter pub get

  5. Last thing before using firebase, you must initialize App,使用firebase之前的最后一件事,你必须初始化App,

    final Future _initialization = Firebase.initializeApp(); final Future _initialization = Firebase.initializeApp();

put this line somewhere, I suggest in MaterialApp before the application is built.将此行放在某处,我建议在构建应用程序之前在 MaterialApp 中。

$ flutter pub get $ flutter pub 获取

simply means It will install the package for you.只是意味着它将为您安装软件包。 In vs code you don't need to do anything just add the package in pubspec.yaml and save it.在 vs 代码中你不需要做任何事情,只需在 pubspec.yaml 中添加包并保存它。 Automatically flutter pub get will run for you.自动 flutter pub get 将为您运行。 and if it is not run automatically just type flutter pub get in terminal and it will install the package for you.如果它没有自动运行,只需在终端中输入 flutter pub get ,它就会为你安装软件包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我试图将我的 flutter 应用程序与 firebase 连接起来,但我遇到了这个错误 - I tried to connect my flutter app with firebase and I catch up with this error 如何使用 Flutter 从 Firebase 获取当前活跃用户? - How I can get current active users from Firebase with Flutter? 当我将 Firebase 连接到我的 Flutter 项目时,出现错误 - When I connect Firebase to my Flutter project, I get an error Flutter App如何在Firebase中集成身份验证和数据库? - How to integrate authentication and database in Firebase for Flutter App? 如何将我的 Android 应用程序连接到谷歌驱动器? - How can i connect my Android app to google drive? 如何在 Flutter App 上自动增加内部版本号? - How can I auto-increment build number on Flutter App? 我如何使用 AndroidStudio BumbleBee 将 flutter 模块添加到 android 应用程序 - How i can add flutter module to android app with AndroidStudio BumbleBee 如何使用Android应用程序连接到MySQL数据库? - How can i connect to my MySQL database with an android app? 如何将我的 Android 应用程序与在线 mysql 数据库连接? - How can i connect my Android app with the online mysql database? 如果我的 android 本机应用程序中有多个模块,如何连接 firebase - How to connect firebase if I have multiple modules in my android native app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM