I'm trying to make a flutter app where if the user is logged in and uploads an image of a specific challenge, the uploaded image is inside of the challenge folder, and that challenge folder is inside of the user folder(named with the user's name), and that user folder is inside of a folder called 'users' in my firebase console.
I basically developed an authentication protocol that the user can sign up or log in to my app using their own email(It's not like a google authentication though, just submitting their email account and password).
But I can't really tell where to start to develop the protocol that I've mentioned above.
It is actually quite easy. You need to create a Reference
as explained in the doc, based on the path you describe in your question:
String userIdentifier = '...'; // E.g. the user ID or the user email, it all depends on your authentication mechanism
String imageName = '...';
final storageRef = FirebaseStorage.instance.ref();
final userImageRef = storageRef.child("users/" + userIdentifier + "/challenge/" + imageName);
Then, with this Reference
you upload the image file as explained here in the doc.
Note that the userIdentifier
and imageName
values should not contain a slash (/
)