I'm using latest firebase_storage version now some methods and references of storage are updated ploadTask.onComplete does not support.
so how do I get uploaded pdf url?
Piece of code:
Future<String> uploadPdfToStorage(File pdfFile) async {
try {
Reference ref = FirebaseStorage.instance.ref().child('pdfs/${DateTime.now().millisecondsSinceEpoch}');
UploadTask uploadTask = ref.putFile(pdfFile, SettableMetadata(contentType: 'pdf'));
String downloadUrl = await (await uploadTask.onComplete).ref.getDownloadURL();
final String url = await downloadUrl;
print("url:$url");
return url;
} catch (e) {
return null;
}
}