- Published on
System Design: Flutter Web App Production Deployment with Netlify
- Authors
- Name
- Loi Tran
Introduction

- Create new Flutter Project:
flutter create system_design_deploy_flutter_netlify
cd system_design_deploy_flutter_netlify
git init
git add .
git commit -m "Initial commit"
- Create new remote Github Repo & Push code:
- https://github.com/new
- Create repo named
system_design_deploy_flutter_netlify
git remote add origin git@github.com:PrimeTimeTran/system_design_deploy_flutter_netlify.git
git branch -M main
git push -u origin main
- Create new Netlify App:
- https://app.netlify.com
- Add New Site > Choose Existing Project > Github >
system_design_deploy_flutter_netlify
- Build Settings:
- Build Command:
if cd flutter; then git pull && cd ..; else git clone https://github.com/flutter/flutter.git; fi && flutter/bin/flutter config --enable-web && flutter/bin/flutter build web --release
- Publish Directory:
build/web
- Build Command:
- Deploy Site.
- Watch logs looking for build success:
- If everything went smoothly you should eventually see a "Published" keyword in the site's overview page under "Production Deploys"
Conclusion
Deploying Flutter to Netlify can be trickier than other frameworks due to Netlify not having Flutter installed on each of their server instances.
We can get around this issue by checking for flutter's installation in our build command.
if cd flutter; then git pull && cd ..; else git clone https://github.com/flutter/flutter.git; fi && flutter/bin/flutter config --enable-web && flutter/bin/flutter build web --release
If the host system, the machine about to run the build command, doesn't have Flutter installed then install it before creating a web build of the Flutter app.