Home > Back-end >  StorangeReference firebase storage not working
StorangeReference firebase storage not working

Time:06-12

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);

}

}enter image description here

CodePudding user response:

Use Storage reference like this.

Reference postImageRef  = FirebaseStorage.instance.ref().child("Post Images");
  • Related