Deploying a Flutter Web App on Vercel

SuneelSuneel
3 min read

Flutter’s SDK empowers developers to create cross-platform applications that run seamlessly on multiple platforms. With Flutter, you can “write once, deploy everywhere”, making it an excellent choice for building web applications.

In this guide, we’ll walk through the deployment of a Flutter web app on Vercel, a popular hosting platform known for its fast and scalable deployments.

Requirements

Before we get started, ensure you have the following:

  • A Vercel account

  • A GitHub account

  • A Flutter project


Step-by-Step Deployment Guide

Step 1: Create a GitHub Repository

First, create a new repository on GitHub. For this guide, we’ll name it flutterweb_vercel.

Step 2: Set Up Your Flutter Project

Next, create a new Flutter project and push it to the GitHub repository:

flutter create flutterweb_vercel

Commit and push the project to your repository.

Step 3: Set Up a Vercel Project

Now, head over to Vercel and create a new project. Let’s name it flutter_app.

To ensure a smooth deployment, update the build settings in Vercel. Override the following settings:

Build Command:

flutter/bin/flutter build web --release

Output Directory:

build/web

Install Command:

if cd flutter; then git pull && cd .. ; else git clone https://github.com/flutter/flutter.git; fi && ls && flutter/bin/flutter doctor && flutter/bin/flutter clean && flutter/bin/flutter config --enable-web

Step 4: Deploy the App

Click on the “Deploy” button and let Vercel handle the rest. The platform will pull your code, build the project, and deploy it.

Step 5: Access Your Live App

Once the deployment is successful, Vercel will provide a unique URL where your Flutter web application is live.


How Vercel Works

Vercel simplifies deployment with a streamlined workflow that integrates with GitHub. Here’s how it works:

  1. Local Development: You develop and test your application locally.

  2. Version Control with GitHub: Once ready, push your code to a GitHub repository.

  3. Automatic Deployment: Vercel detects new commits and triggers a deployment.

  4. Build Process: Vercel compiles the code, runs necessary scripts, and prepares the app for hosting.

  5. Live Deployment: The application is deployed to the web, making it publicly accessible via a unique URL.

This workflow ensures an efficient, continuous deployment process, making it easy to maintain and update your app.


Conclusion

Deploying a Flutter web app on Vercel is quick and hassle-free, combining Flutter’s cross-platform power with Vercel’s seamless hosting capabilities. By following these simple steps, you can get your Flutter web application up and running in no time.

This method not only simplifies deployment but also enables continuous integration with Git repositories, ensuring smooth updates and scalability.

Give it a try and let me know your thoughts! 🚀

0
Subscribe to my newsletter

Read articles from Suneel directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Suneel
Suneel