Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get url of uploaded media in supabase storage in flutter?

In flutter for uploading image according to doc is

final avatarFile = File('path/to/file');
final response = await supabase
  .storage
  .from('avatars')
  .upload('public/avatar1.png', avatarFile, fileOptions: FileOptions(
    cacheControl: '3600',
    upsert: false
  ));

So, how we can get the downloadUrl of this uploaded media ?

like image 688
tailor Avatar asked Nov 30 '25 01:11

tailor


1 Answers

You can use the getPublicUrl method:

final res = supabase
  .storage
  .from('avatars')
  .getPublicUrl('public/avatar1.png');

final publicURL = res.data;

See https://supabase.com/docs/reference/dart/storage-from-getpublicurl

like image 125
thorwebdev Avatar answered Dec 01 '25 16:12

thorwebdev