With the Firebase framework-aware CLI, you can deploy your Flutter application to Firebase.
Before you begin
Before you get started deploying your app to Firebase, review the following requirements and options:
- Firebase CLI version 12.1.0 or later. Make sure to install the CLI using your preferred method.
- Optional: Billing enabled on your Firebase project (required if you plan to use SSR)
Initialize Firebase
To get started, initialize Firebase for your framework project.
Use the Firebase CLI for a new project, or modify firebase.json
for an
existing project.
Initialize a new project
- In the Firebase CLI, enable the web frameworks preview:
firebase experiments:enable webframeworks
Run the initialization command from the CLI and then follow the prompts:
firebase init hosting
Answer yes to "Do you want to use a web framework? (experimental)"
Choose your hosting source directory; this could be an existing Flutter app.
If prompted, choose Flutter Web.
Initialize an existing project
Change your hosting config in firebase.json
to have a source
option, rather
than a public
option. For example:
{
"hosting": {
"source": "./path-to-your-flutter-app"
}
}
Serve static content
After initializing Firebase, you can serve static content with the standard deployment command:
firebase deploy