I am using firebase storage to upload image and i need first that image upload to storage and then donwload url set to imageUrl String url. So that i can pass it into api call. But by using await method its skipped that line of code and moves ahead. And URL is updating after api call.
I have attached the code image for best understanding.
CodePudding user response:
Try this:
await uploadTask.snapshot.ref.getDownloadURL()
.then((value) => setState(() {
isModifyPhoto = true;
imageUrl = value;
}));
CodePudding user response:
I did it by making onTap() method async and await uploadprofile() method call. Its working good now.