Flutter web app not updating in firebase hosting

Ankit dwivedi
2 min readApr 8, 2023

--

If your firebase hosting not updating after successful deployment or flutter web build creating old version and website shows only old version and you stuck and no idea what is happening because you have deployed correctly then you are in the right place today we discuss how to solve this problem.

Method 1

First this problem might arise because caching, so in your chrome disable cache.

before deploying do changes in your `firebase.json` inside flutter working project, deploy after this in firebase hosting.

Method 2

If the problem still there than we can take a further step to solve this. In your flutter project Delete web platform and build/web folders.

open command prompt and run

> flutter create — platforms web .

this will create web folder in your project directory

again build for web

> flutter build web

or run below command, if you have any problem, such as not showing image in web version.

> flutter build web --web-renderer html --release

to run and test flutter web app locally you need to install lite-server run in your command prompt

> npm install -g lite-server

after successful install from your working project directory run

> cd build/web && lite-server

It will run you web app locally on your machine. So before deploying to the firebase hosting do some more changes in `firebase.json` and `index.html` file.

firebase.json

index.html

then deploy again in firebase hosting and it will work.

--

--

Ankit dwivedi

Software developer ? ( Flutter || Dart || IOS ||C# || Nodejs || Kotlin || Java || Android ) : Writing