Skip to content
Back

Image transformations

  • 0
  • 3
  • Flutter
  • Web
  • Storage
  • Cloud
Aaruul
25 Nov, 2025, 06:56

On flutter web, when using image transformations, the results are being cached. When I replace an image, the old version still appears. Is it possible to manually clear the cache? Also, how long does the cache last before it expires?

FutureBuilder( key: ValueKey('photo-${widget.user?.id ?? '--'}'), future: storage.getFilePreview( bucketId: Environment.profilePhotos, fileId: widget.user!.id!, // Image name gravity: ImageGravity.center, output: ImageFormat.webp, width: 100, ), //works for both public file and private file, for private files you need to be logged in builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { return CircularProgressIndicator(); } if (snapshot.connectionState == ConnectionState.done && snapshot.hasData && snapshot.data != null) { return Image.memory(snapshot.data!, width: widget.radius, height: widget.radius); }

TypeScript
return CircleAvatar(minRadius: widget.radius, maxRadius: widget.radius, child: Text(widget.user?.getGivenFirstLetter ?? '--'));

}, );

TL;DR
To avoid caching issues, upload a new image with a new ID instead of replacing the existing one.
25 Nov, 2025, 09:23

when you replace the image it should have a completely different preview link, so caching wont affect it. can you please see if your correctly replacing the image?

25 Nov, 2025, 20:33

I highly discourage replacing an image like this. Even if we clear our cache, clients (browsers or a library you're using) may have the old image cached. As such, I highly suggest uploading a new file with a new id

1
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more