Mobile App Development — Level 3: Firebase, Architecture & Testing
Free preview

Setting up Firebase with FlutterFire

1 / 3

Firebase

  • Google's app back end
  • Auth, Firestore, Storage, FCM
  • Free Spark plan
2 / 3

FlutterFire CLI

  • firebase login
  • flutterfire configure
  • firebase_options.dart
3 / 3

Initialise

  • firebase_core
  • Firebase.initializeApp
  • Before runApp

Lecture notes

Firebase is Google's Backend-as-a-Service: authentication, databases, file storage, push notifications, analytics, crash reporting and hosting — without managing servers. The free Spark plan covers learning and small apps; Blaze is pay-as-you-go.

Setup steps

  1. Create a project at console.firebase.google.com.
  2. Install the Firebase CLI (npm install -g firebase-tools) and log in: firebase login.
  3. Install the FlutterFire CLI: dart pub global activate flutterfire_cli.
  4. In your project: flutterfire configure — select the Firebase project and platforms; it registers the apps and generates lib/firebase_options.dart.
  5. Add the core package: flutter pub add firebase_core.

Initialise before runApp

import 'package:firebase_core/firebase_core.dart';
import 'firebase_options.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
  runApp(const MyApp());
}

Firebase products you will use

  • firebase_auth — sign-in.
  • cloud_firestore — NoSQL document database with real-time updates and offline cache.
  • firebase_storage — files and images.
  • firebase_messaging — push notifications (FCM).
  • firebase_crashlytics, firebase_analytics — quality and usage (Level 4).

The values in firebase_options.dart identify your project; they are not secret, but your data must be protected with Security Rules and App Check.

Want to go further?
20 h · Enroll to access every lesson and earn the certificate.
Get Started Free