Building Progressive Web Apps with FlutterFire
Oct 2, 2025



Summary
Summary
Summary
Summary
This tutorial shows how to build Progressive Web Apps with Flutter and FlutterFire. It covers Firebase initialization on web, enabling offline-first Firestore, configuring the web manifest and service worker, deploying to Firebase Hosting, and practical auth and performance tips for mobile development teams aiming for installable, reliable web apps.
This tutorial shows how to build Progressive Web Apps with Flutter and FlutterFire. It covers Firebase initialization on web, enabling offline-first Firestore, configuring the web manifest and service worker, deploying to Firebase Hosting, and practical auth and performance tips for mobile development teams aiming for installable, reliable web apps.
This tutorial shows how to build Progressive Web Apps with Flutter and FlutterFire. It covers Firebase initialization on web, enabling offline-first Firestore, configuring the web manifest and service worker, deploying to Firebase Hosting, and practical auth and performance tips for mobile development teams aiming for installable, reliable web apps.
This tutorial shows how to build Progressive Web Apps with Flutter and FlutterFire. It covers Firebase initialization on web, enabling offline-first Firestore, configuring the web manifest and service worker, deploying to Firebase Hosting, and practical auth and performance tips for mobile development teams aiming for installable, reliable web apps.
Key insights:
Key insights:
Key insights:
Key insights:
PWA fundamentals: Use web manifest and service worker to create an app shell that supports installability and offline caching.
Initializing Firebase: Call Firebase.initializeApp early in main and generate web options with the FlutterFire CLI for web integration.
Offline-first Firestore: Enable persistence so snapshots deliver cached data offline and synchronize when connectivity returns.
Hosting & Service Worker: Deploy the built web directory to Firebase Hosting, set SPA rewrites, and serve a custom worker for advanced caching.
Auth & UX: Use Firebase Auth popup or redirect flows on web, show cached UI while auth resolves, and surface sync state to users.
Introduction
Progressive Web Apps bring app-like experiences to the web: offline support, installable app shell, fast startup, and reliable updates. Flutter already compiles to web, and FlutterFire connects Flutter apps to Firebase back ends. This tutorial shows how to combine Flutter web with FlutterFire to build PWA-capable mobile development experiences that feel native on phones and desktops.
Why Flutter + Firebase for PWAs
Flutter provides the UI and single codebase; Firebase supplies realtime database, auth, hosting, and edge delivery. For mobile development teams targeting web PWAs, this combination simplifies synchronization, authentication, and hosting workflows. Key PWA affordances we will enable: web manifest, service worker caching, offline-first Firestore usage, and deploying to Firebase Hosting for HTTPS and a global CDN.
Initialize FlutterFire for Web
Start with a Flutter project that has web enabled. Add FlutterFire packages you need: firebase_core, firebase_auth, cloud_firestore. Use the FlutterFire CLI to generate DefaultFirebaseOptions for your project and register your web app in the Firebase console.
In main.dart, initialize Firebase before running the app. This ensures plugins like Firestore and Auth are ready on web startup.
import 'package:firebase_core/firebase_core.dart';
import 'firebase_options.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
runApp(MyApp());
}
This is the minimal required step so FlutterFire services can be used by the rest of your code. Keep initialization async and early in the app lifecycle.
Making Firestore Offline-First
PWAs must handle transient connectivity. Firestore supports offline persistence on web when configured. Set Firestore settings at startup so reads and writes use local cache and synchronize when online.
import 'package:cloud_firestore/cloud_firestore.dart';
void configureFirestore() {
FirebaseFirestore.instance.settings = const Settings(persistenceEnabled: true);
}
Call configureFirestore after Firebase.initializeApp. Design your UI to listen to snapshot streams; those streams will yield cached data when offline and update when connectivity returns. Use local optimistic updates for writes and surface syncing state to users.
App Shell, Manifest, and Service Worker
PWA behavior depends on a web manifest and a service worker. Flutter web generates a flutter_service_worker.js and a manifest file under web/ by default. Update web/manifest.json to include name, short_name, display 'standalone', orientation, and icons sized for mobile devices. Example keys to check: short_name, start_url, display, background_color, theme_color.
If you need custom caching beyond the default generated worker, add a custom service worker and configure Firebase Hosting to serve it. Common strategy: cache app shell assets aggressively and treat API routes or Firestore reads as network-first or cache-then-network depending on data freshness needs.
Deploying to Firebase Hosting
Use the Firebase CLI to deploy your PWA. Configure firebase.json with a rewrite rule to serve index.html for single page app routing. Example hosting considerations: enable clean URLs, set caching headers for static assets, and use the hosting CDN for fast delivery.
Typical workflow:
build web output: flutter build web --web-renderer canvaskit (optional for performance)
firebase deploy --only hosting
This delivers your app over HTTPS, enables install prompts on supported browsers, and uses the hosting global edge network.
Authentication and UX Considerations
Add Firebase Authentication to gate user-specific features. On web, OAuth flows require using popup or redirect methods and configuring OAuth consent in the Firebase console. Provide an app shell that loads quickly while auth state resolves; show cached content if available and explain syncing. For mobile development teams, test installability on both Android and iOS browsers and validate progressive enhancement: offline reads, queued writes, and graceful degradation where Service Worker features are missing.
Performance and Measurement
Use Lighthouse audits to measure PWA score, accessibility, and performance. On Flutter web, reduce bundle size by trimming unused packages, using deferred imports where appropriate, and choosing CanvasKit only when needed for complex graphics. Monitor authenticated traffic, Firestore reads, and writes to control costs.
Vibe Studio

Vibe Studio, powered by Steve’s advanced AI agents, is a revolutionary no-code, conversational platform that empowers users to quickly and efficiently create full-stack Flutter applications integrated seamlessly with Firebase backend services. Ideal for solo founders, startups, and agile engineering teams, Vibe Studio allows users to visually manage and deploy Flutter apps, greatly accelerating the development process. The intuitive conversational interface simplifies complex development tasks, making app creation accessible even for non-coders.
Conclusion
Building PWAs with FlutterFire gives mobile development teams a straightforward path to deliver app-like web experiences using the same Flutter UI codebase. Key steps: initialize Firebase on web, enable Firestore persistence for offline-first behavior, supply a proper web manifest and service worker for the app shell, and deploy to Firebase Hosting. With these pieces in place you get installable, reliable, and fast experiences that mirror native apps on mobile devices.
Introduction
Progressive Web Apps bring app-like experiences to the web: offline support, installable app shell, fast startup, and reliable updates. Flutter already compiles to web, and FlutterFire connects Flutter apps to Firebase back ends. This tutorial shows how to combine Flutter web with FlutterFire to build PWA-capable mobile development experiences that feel native on phones and desktops.
Why Flutter + Firebase for PWAs
Flutter provides the UI and single codebase; Firebase supplies realtime database, auth, hosting, and edge delivery. For mobile development teams targeting web PWAs, this combination simplifies synchronization, authentication, and hosting workflows. Key PWA affordances we will enable: web manifest, service worker caching, offline-first Firestore usage, and deploying to Firebase Hosting for HTTPS and a global CDN.
Initialize FlutterFire for Web
Start with a Flutter project that has web enabled. Add FlutterFire packages you need: firebase_core, firebase_auth, cloud_firestore. Use the FlutterFire CLI to generate DefaultFirebaseOptions for your project and register your web app in the Firebase console.
In main.dart, initialize Firebase before running the app. This ensures plugins like Firestore and Auth are ready on web startup.
import 'package:firebase_core/firebase_core.dart';
import 'firebase_options.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
runApp(MyApp());
}
This is the minimal required step so FlutterFire services can be used by the rest of your code. Keep initialization async and early in the app lifecycle.
Making Firestore Offline-First
PWAs must handle transient connectivity. Firestore supports offline persistence on web when configured. Set Firestore settings at startup so reads and writes use local cache and synchronize when online.
import 'package:cloud_firestore/cloud_firestore.dart';
void configureFirestore() {
FirebaseFirestore.instance.settings = const Settings(persistenceEnabled: true);
}
Call configureFirestore after Firebase.initializeApp. Design your UI to listen to snapshot streams; those streams will yield cached data when offline and update when connectivity returns. Use local optimistic updates for writes and surface syncing state to users.
App Shell, Manifest, and Service Worker
PWA behavior depends on a web manifest and a service worker. Flutter web generates a flutter_service_worker.js and a manifest file under web/ by default. Update web/manifest.json to include name, short_name, display 'standalone', orientation, and icons sized for mobile devices. Example keys to check: short_name, start_url, display, background_color, theme_color.
If you need custom caching beyond the default generated worker, add a custom service worker and configure Firebase Hosting to serve it. Common strategy: cache app shell assets aggressively and treat API routes or Firestore reads as network-first or cache-then-network depending on data freshness needs.
Deploying to Firebase Hosting
Use the Firebase CLI to deploy your PWA. Configure firebase.json with a rewrite rule to serve index.html for single page app routing. Example hosting considerations: enable clean URLs, set caching headers for static assets, and use the hosting CDN for fast delivery.
Typical workflow:
build web output: flutter build web --web-renderer canvaskit (optional for performance)
firebase deploy --only hosting
This delivers your app over HTTPS, enables install prompts on supported browsers, and uses the hosting global edge network.
Authentication and UX Considerations
Add Firebase Authentication to gate user-specific features. On web, OAuth flows require using popup or redirect methods and configuring OAuth consent in the Firebase console. Provide an app shell that loads quickly while auth state resolves; show cached content if available and explain syncing. For mobile development teams, test installability on both Android and iOS browsers and validate progressive enhancement: offline reads, queued writes, and graceful degradation where Service Worker features are missing.
Performance and Measurement
Use Lighthouse audits to measure PWA score, accessibility, and performance. On Flutter web, reduce bundle size by trimming unused packages, using deferred imports where appropriate, and choosing CanvasKit only when needed for complex graphics. Monitor authenticated traffic, Firestore reads, and writes to control costs.
Vibe Studio

Vibe Studio, powered by Steve’s advanced AI agents, is a revolutionary no-code, conversational platform that empowers users to quickly and efficiently create full-stack Flutter applications integrated seamlessly with Firebase backend services. Ideal for solo founders, startups, and agile engineering teams, Vibe Studio allows users to visually manage and deploy Flutter apps, greatly accelerating the development process. The intuitive conversational interface simplifies complex development tasks, making app creation accessible even for non-coders.
Conclusion
Building PWAs with FlutterFire gives mobile development teams a straightforward path to deliver app-like web experiences using the same Flutter UI codebase. Key steps: initialize Firebase on web, enable Firestore persistence for offline-first behavior, supply a proper web manifest and service worker for the app shell, and deploy to Firebase Hosting. With these pieces in place you get installable, reliable, and fast experiences that mirror native apps on mobile devices.
Build Flutter Apps Faster with Vibe Studio
Build Flutter Apps Faster with Vibe Studio
Build Flutter Apps Faster with Vibe Studio
Build Flutter Apps Faster with Vibe Studio
Vibe Studio is your AI-powered Flutter development companion. Skip boilerplate, build in real-time, and deploy without hassle. Start creating apps at lightning speed with zero setup.
Vibe Studio is your AI-powered Flutter development companion. Skip boilerplate, build in real-time, and deploy without hassle. Start creating apps at lightning speed with zero setup.
Vibe Studio is your AI-powered Flutter development companion. Skip boilerplate, build in real-time, and deploy without hassle. Start creating apps at lightning speed with zero setup.
Vibe Studio is your AI-powered Flutter development companion. Skip boilerplate, build in real-time, and deploy without hassle. Start creating apps at lightning speed with zero setup.











