Installation

Jun's Coding Journey·2023년 9월 17일
0

[Learn] Firebase

목록 보기
2/7

Setting up Firebase for a Flutter application involves several steps. The following is a general guideline for integrating Firebase into a Flutter project. The exact details might vary based on the specific Firebase services you plan to use and the platforms (iOS, Android, web) you're targeting.

Since I am using a iOS platform, this process will be based on macOS.

 

CLI

  • Run the following command:
curl -sL https://firebase.tools | bash
  • Log into Firebase using your Google account on the web and run the following command on the CLI:
firebase login

 

Project Directory

  • Install the FlutterFire CLI by runnig the following command from a project directory. This is to allow Flutter to communicate with Firebase.
dart pub global activate flutterfire_cli
  • From your Flutter project directory, run the following command to use the FlutterFire CLI to configure your Flutter apps to connect to Firebase.
flutterfire configure
  • When prompted, create a project name (this name needs to be unique).

  • Choose the platform you want your project to run.

  • To make sure Firebase code works, run the following command to install the core plugin.

flutter pub add firebase_core
  • There are a lot of plugins to use in Firebase, but here are a few essential ones (start with 'flutter pub add'):
firebase_auth // authentication
cloud_firestore // database
firebase_storage // user files
  • To make sure the Flutter code in your project is initialized and runs smoothly, add the following code on your main.dart file:
await Firebase.initializeApp(
  options: DefaultFirebaseOptions.currentPlatform,
);
profile
Greatness From Small Beginnings

0개의 댓글