Any idea why I can’t return a String to my `upload...
# android
o
Any idea why I can’t return a String to my
uploadFileToFirebase
function? What am I doing wrong? (part in red says):
Copy code
return is not allowed here
r
You’re trying to return synchronously in an asynchronous code.
o
@ribesg Can you please help? I am really short on time I need to upload a file to Firebase (uses Firebase callbacks), get that file download URL(uses Firebase callbacks), and sent it to my backend (uses coroutines) How can I combine the code above which uses Firebase callbacks with my backend coroutines call? (approximately, pseudocode is good too) This is my method that sends the file download URL to my backend:
r
Your function simply cannot return a String because it’s using callbacks, you could add a callback parameter of type
(String) -> Unit
to that function and call it instead of trying to return
(I actually would use
(Result<String>) -> Unit
and call it in the failure listener too)
You’re probably missing a failure listener on
downloadUrl
too
o
image.png
true, i have added a failure listener thanks