void uploadStatusImage() async { if (validateAndSave()) { final StorageReference postImageRef = FirebaseStorage.instance.ref().child("Post Images");
var timeKey = new DateTime.now();
final StorageUploadTask uploadTask =
postImageRef.child(timeKey.toString() ".jpg").putFile(sampleImage);
var ImageUrl = await (await uploadTask.onComplete).ref.getDownLoadURL();
var url = ImageUrl.toString();
print("Image Url =" url);
goToHomePage();
saveToDabase(url);
}
CodePudding user response:
Use Storage reference like this.
Reference postImageRef = FirebaseStorage.instance.ref().child("Post Images");