How to deploy Flutter Web to my own server?

Viewed 6125

I've just created a flutter web application and now I am ready to deploy it. Looking at the docs it looks like I need to use Firebase Hosting? But I want to host the app on my own server. I tried copying the web directory from Build but when I go to the path I get a blank screen on web. How do I deploy it correctly? Or is it just simply not possible without Firebase?

1 Answers

First you need to compile the application.

In a terminal, command prompt or Powershell, go to the root directory of your project.

From there run a build:

flutter build web

This will create a new directory inside your project.

c:\your-project-folder\build\web

Copy everything that is in the web folder to wherever you want to publish / host your application.

Your application is bundled up into a main.dart.js file.

An index.html is also in that directory. You should be able to run your Flutter web app by visiting that index.html.

All the instructions for building a Flutter application for web platform is here.

flutter build web directory

Related