from.getPublicUrl()

Retrieve URLs for assets in public buckets

1  final String publicUrl = supabase
2    .storage
3    .from('public-bucket')
4    .getPublicUrl('avatar1.png');

Notes#

  • The bucket needs to be set to public, either via updateBucket() or by going to Storage on app.supabase.com, clicking the overflow menu on a bucket and choosing "Make public"
  • Policy permissions required:
    • buckets permissions: none
    • objects permissions: none

Examples#

Returns the URL for an asset in a public bucket#

1  final String publicUrl = supabase
2    .storage
3    .from('public-bucket')
4    .getPublicUrl('avatar1.png');