How to deploy flutter web app to firebase hosting
Hello folks, today we will discuss how to deploy your Flutter web app to Firebase.
Flutter gives us huge power and when it combines with Firebase it will become massive, once uncle ben says that :
Great power comes with great responsibilities
I assume that you already created your Flutter project. If not follow any video tutorial on youtube to get started with and build your first flutter project.
Step -1 Create Project
Login and create your project in the Firebase console
Do the changes in your flutter project web folder
Step -2 : Index.html
Step-3 : Install Node
Download the latest nodejs from below link
Open your Command Prompt or Terminal
Run commands
- npm install -g firebase-tools
2. firebase login
After successful login navigate to your project directory
run firebase init
Give your flutter web build folder => build/web
Next See all the question and answer as you required, I choose here all as N and hit enter.
Do the changes in you firebase.json find inside your project folder
In you firebase console project create new website in hosting section
In your terminal run command
firebase target:apply hosting myrandomsitename app_project_id
you can find your project Id in your project setting
and at last you should run command in your terminal
firebase deploy
or
firebase deploy — only hosting:myrandomsitename
That’s it guys your website is now hosted in firebase hosting, go and check the link :)