简体   繁体   中英

How do I get the full path of my firebase storage item? (including the gs://)

My Issue

I'd like to have the full url such as:

gs://my-app-name.appspot.com/companies/666d236f-a075-492d-8110-a3f4bd6d7f18/logo

My Solution

I'm using the response from uploading to build the url like this:

const res = await uploadBytes(storageRef, file);
const gsPath = `gs://${res.ref.bucket}/${res.ref.fullPath}`

My Question

I looked the docs but didn't find any method or property to get the full url without constructing it myself. Am I missing something?

You can use the getDownloadURL() method. Docs

final fb_storage = FirebaseStorage.instance; return await fb_storage.ref().child("ImageCollectionName").child("ImageID").getDownloadURL();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM