DEV Community

Cover image for Simplest way to deploy a Flutter Web App
Benard Mseti
Benard Mseti

Posted on

Simplest way to deploy a Flutter Web App

Flutter is a cross-platform framework which allows us to build and deploy apps for different platforms using a single codebase.

In this tutorial, you'll learn how to deploy your Flutter webapp using Railway.

Let's dive in!

Open your IDE terminal and run

flutter build web --web-renderer html
Enter fullscreen mode Exit fullscreen mode

This will ensure that the webapp uses html rendering on all devices that it is accessed from.

Let the app build run:

Image description

Next

In the project folder look for build/web file directory

Image description

Right click on the web directory and open the file -> Use Finder(mac)/File Explorer(Windows).

Image description

The web directory carries our whole compiled Flutter web app.

Next step is to commit the files to github.

Open github and create a new repository with your desired name.

Image description

Image description

You can make the repository public/private depending on your requirements.

Image description

Click on upload existing files as seen above and then drag and drop the contents from our web directory to the github repository and wait for all files to be uploaded.

Once upload is done, commit changes and wait for the files to be proceed.
Image description

Your repository should now look like this 👇🏾

Image description

Let's set up railway

Next go to railway and follow below steps.

  1. Click on start a new project
    Image description

  2. Choose deploy from github repo

Image description

  1. Login and authorize railway with your github account

Image description

  1. Choose repository to deploy, ours was 'myappname'

Image description

  1. Select Deploy Now

Image description

  1. Wait for build to finish

Image description

  1. Select Add a Domain

Image description

  1. Voila! You now have successfully deployed your Flutter Webapp, you can access it through the link provided.

Image description

Here's the example site

Image description

github webapp project

Connect with me on twitter 😊 if you have any questions.

Top comments (0)