Flutter
Coding and Programming
09
1 What is Firebase?
Firebase is a platform developed by Google for
building and managing mobile and web
applications.
Designed to help developers build apps faster
by handling backend infrastructure, analytics,
and other essential services.
Brief History of Firebase
o Founded in 2011 as a real-time database
company.
o Acquired by Google in 2014 and expanded to
include various other services
2-1 Firebase Core Services
Firebase Realtime Database vs. Cloud
Firestore
Realtime Database:
NoSQL database that stores data as
JSON and syncs it in real-time.
Best for simple real-time applications like
chat apps.
Cloud Firestore:
More structured NoSQL database,
supports offline data, advanced queries,
and complex data hierarchies.
2-2 Firebase Core Services
Firebase Authentication
Provides tools for user sign-up and log-
in with popular options (Google,
Facebook, email/password, phone
number).
Key Features: Secure token-based
authentication, easy integration, and
support for multi-factor authentication.
Use Case: Social media apps, e-
commerce apps.
2-3 Firebase Core Services
Firebase Cloud Storage
Cloud storage solution for user-
generated content like images, videos,
and files.
Integrates with Firebase Authentication
for secure access control.
Use Case: Storing profile pictures, files,
or large media files.
3 Setting Up Firebase CLI
Step 1: Install Firebase CLI
Firebase CLI requires Node.js. Download and
install Node.js from nodejs.org.
Step 2: Install Firebase CLI
Open your terminal or command prompt and
install Firebase CLI globally: npm install -g
firebase-tools
Add this Path to environment variables on
windows: C:\Users\OS\AppData\Local\Pub\
Cache\bin
Verify the installation: firebase --version
Step 3: Login to Firebase
Run the following command to log in to your
Firebase account: firebase login
4-1 Adding Firebase to Your Flutter
Project
Step 1: Open Firebase Account
Create project on firebase account
Create database into firebase project
Step 2: Open Terminal in Your Flutter Project Folder
Open Terminal in Your Flutter Project Folder
Step 3: Initialize Firebase in Your Flutter Project
Add this Use the Firebase CLI to initialize Firebase in your Flutter project:
firebase init
4-2 Adding Firebase to Your Flutter
Project
Step 4: Open Firebase Project settings
Click on flutter icon for configuration
Install and run the FlutterFire CLI
dart pub global activate flutterfire_cli
flutterfire configure --project=student-935ea
Step 5: Install Packages to flutter project
firebase_core: ^3.7.0
firebase_messaging: ^15.1.4
Step 6: Past this code on main method
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
String? token = await
FirebaseMessaging.instance.getToken();
Thanks
Do you have any
questions?
!
Resources
https://flutter.dev