Zenko
Zenko

Reputation: 2559

How do I read and write image file locally for Flutter Web?

I was looking for ways to read and write image files in Flutter Web into local directory. The purpose is so the site won't need to download the images twice. For example: we can check if the file exist and if it doesn't then we can download it.

We can do this easily in Flutter App like this:

So is there any equivalent of the above solutions in Flutter Web?

Thank you

Upvotes: 2

Views: 3769

Answers (2)

Zenko
Zenko

Reputation: 2559

Although the answer above is the accepted answer, but the solution above but only works while the browser is open.

Finally I found out that I do not need to worry about saving it locally anyway the browser keeps temporary internet files in its cache. Duh...!

Upvotes: 1

Birju Vachhani
Birju Vachhani

Reputation: 6353

I don't think it can be done using files on web. However you can use SharedPreferences for the same purpose.

SharedPreferences supports web: shared_preferences

Upvotes: 1

Related Questions