Hi,
I'm using this for an app that will predominantly run on a desktop (not mobile).
My files are stored in the default bucket, in a folder named audio at the root.
I can get all the files from that folder using a function like:
Future<ListResult> listAll() async {
var app = await Firebase.initializeApp(
options: FirebaseOptions.fromMap(json.decode(File('firebase-config.json').readAsStringSync()))
);
var storage = FirebaseStorage.instanceFor(app: app);
var results = await storage.ref("audio").listAll();
return results;
}
Note: Also tried with await.storage.ref().child('audio').listAll();
But when I loop the returning files, each one appears with the root folder "duplicated".
For example, the fullPath property of each Reference is audio/audio/file.mp3 instead of audio/file.mp3.
This results in a "file not found" when i'm trying to get a download url. The url comes as: gs://bucket-name.appspot.com/audio/audio/file.mp3 - with double audio/audio.
Update: I can get the right reference by doing something convoluted like: Reference? realItem = item.parent?.parent?.child(item.name); when looping the results, but that feels a bit off.
Any idea what I'm doing wrong?
Many thanks!
Hi,
I'm using this for an app that will predominantly run on a desktop (not mobile).
My files are stored in the default bucket, in a folder named
audioat the root.I can get all the files from that folder using a function like:
Note: Also tried with
await.storage.ref().child('audio').listAll();But when I loop the returning files, each one appears with the root folder "duplicated".
For example, the
fullPathproperty of each Reference isaudio/audio/file.mp3instead ofaudio/file.mp3.This results in a "file not found" when i'm trying to get a download url. The url comes as:
gs://bucket-name.appspot.com/audio/audio/file.mp3- with doubleaudio/audio.Update: I can get the right reference by doing something convoluted like:
Reference? realItem = item.parent?.parent?.child(item.name);when looping the results, but that feels a bit off.Any idea what I'm doing wrong?
Many thanks!