Hosting Flutter Website On Firebase For Free
Last Updated :
29 Aug, 2022
Flutter is a user interface development software development kit. Flutter is an open-source project maintained by Google. It enables software developers to make beautiful natively compiled applications for IOS, Android, Web, and Desktop with a single code base. Although developing flutter applications is very fun and interesting, but it is also important to showcase the product to the end-user. And one of the best ways to do that is by hosting the flutter web application on firebase hosting.
Firebase is also a google’s product available to developers as a backend and a service. It is mainly used to develop and maintain the backend of the software applications. Firebase provides multiple services like real-time database and ML kit and else to help developers focus on the functionality of the application rather than struggling to implement it. So, here we are going to use firebase hosting to host our flutter application. And the most important thing is there are no charges involved to start working with firebase.
Prerequisites:
- Flutter project which is to be hosted. Here we are going to host an interactive story app.
- A Gmail account.
- Node JS installed on the computer. It will enable us to install firebase CLI (command line interface).
Now follow the below steps to Host a flutter web app on Firebase for free:
Step 1: Create a new project on firebase
The first step is to create a project in firebase. Visit firebase.google.com and sign-up if you haven’t already and go to console. Here, we will create a new project and give it any name of our choice.
Step 2: Creating flutter web app
In this step, we will create the web application of the flutter project we have already prepared. I have made an interactive story app that changes the story based on the user’s input. To create the web application of the flutter project we will use the following command ‘flutter build web‘. This will create a light and smooth flutter web application and the build folder inside the web directory. You can even check if there is any problem with the build or not by using this command :
flutter run -d chrome --release
Step 3: Registering App
In this step, we will create a web instance in the firebase project that we have created and register our web app and generate a name (URL) for the flutter web app.
Step 4: Adding Firebase SKD
Now we will add the firebase system development kit in our flutter app. It helps firebase identify the web app, track its version, keep track of its usage. It is done by adding two or three scripts in the body of the index.html page.
Step 5: Installing Firebase CLI
In this step, we will install a firebase command-line interface that lets us interact with firebase and use its functionalities. It is done by running the below command in the terminal:
npm install -g firebase-tools
Step 6: Deploying the app
This is the final step we will deploy our flutter web app to the firebase hosting. First, we need to run the command ‘firebase login‘ to confirm we are connected with the firebase. Then we will initialize the process by running the command ‘firebase inti‘. And now we need to select a few options that you can see in the video below. And after all the initializing steps are done then we will the command ‘firebase deploy‘ or the one was given on the firebase website. This command will push all the files to the hosting server and it will return us a URL to the web app we have successfully hosted. And in this case, it was https://gfg-flutter-story.web.app/, you can check this out if you want.
Full video with all the steps.
Similar Reads
Hosting A Static Website On Firebase For Free
Building a web application is always a time-consuming job, especially for the beginner developers who have just landed their feet in the vast world of programming. And one of the most exciting parts is when the application is available for all to see. Being a new bee in programming most beginners la
5 min read
Google Sign In With Firebase in Flutter Web
Firebase is a product of Google that helps developers to build, manage, and grow their apps easily. It helps developers to build their apps faster and more securely. No programming is required on the Firebase side which makes it easy to use its features more efficiently. Google Sign-in with Firebase
4 min read
Google Sign In With Firebase in Flutter
Firebase is a product of Google that helps developers to build, manage, and grow their apps easily. It helps developers build their apps faster and more securely. No programming is required on the Firebase side which makes it easy to use its features more efficiently. Google Sign-in with Firebase in
6 min read
Flutter - Read and Write Data on Firebase
Firebase helps developers to manage their mobile apps easily. It is a service provided by Google. Firebase has various functionalities available to help developers manage and grow their mobile apps. In this article, we will learn how to write and read data into/from Firebase. Follow the 3-step proce
4 min read
How to Host a Website on GitHub For Free?
GitHub is not only a platform for version control and code management but also a great tool for hosting websites for free. Whether you want to host a personal blog, a project portfolio, or just showcase your work, GitHub Pages offers a simple way to publish a static website directly from a GitHub re
5 min read
Flutter - Store User Details Using Firebase
Firebase is a product of Google that helps developers to build, manage, and grow their apps easily. It helps developers to build their apps faster and in a more secure way. No programming is required on the Firebase side which makes it easy to use its features more efficiently. It provides services
3 min read
Firebase Integration With Web
Firebase is a platform developed by Google for creating mobile and web applications. We will see how to integrate or connect firebase with our sample Web application. Approach: Follow the below steps to integrate your web app with firebase. Firstly we will create a HTML page in the index.html file.O
3 min read
Firebase Authentication with Phone Number OTP in Flutter Web
Phone number verification using Firebase in the Flutter Web app can be done by sending OTP SMS to the phone number. The user will enter the OTP in the message and will easily sign in to his/her account. We are going to implement it in Flutter Web. Step by Step implementation Step 1: Create a new Flu
4 min read
How to Add Firebase to Flutter Project From Mac Terminal?
If you are a Flutter developer you must know that it supports multi-platform applications. It is more hectic to add firebase support for all platforms like web, android, ios, macOS, Linux, and many more to come. For every platform, there are different files and settings which consumes lots of time.
3 min read
How to Add Firebase to Flutter App?
Firebase is a product of Google that helps developers to build, manage, and grow their apps easily. It helps developers to build their apps faster and more securely. No programming is required on the Firebase side which makes it easy to use its features more efficiently. It provides services to Andr
3 min read