I need to link a bunch of images to a job, below is the snip that I am using:
var jobId = 'BzQxgzJ5oYTn8bSEJ4l5';
List filesList = [];
for (var _photo in _imageFileList!) {
final destination = 'JobImages/$jobId/';
final ref = FirebaseStorage.instance.ref(destination);
var file = File(_photo.path);
await ref.putFile(file);
var imageUrl = await ref.getDownloadURL();
filesList.add(imageUrl);
}
The issue that I am having is that I only see one destination: 'JobImages/$jobId/'. The reason why that happens is that the 'destination' variable is not changing. Now I can add a random string at the end of 'destination' but I don't want to do that because that might cause a destination replacement to occur in the future
so I need a way to get the current file names on the server so that I don't double-dip when uploading the new images. how do I do that? or is there a better way to do this?