Firebase ile yeni çalışmaya başladım. çok ilginç bir hata alıyorum.
final Reference ref = await FirebaseStorage.instance.ref().child("deneme").child("resimler").child("kalfa");
UploadTask uploadTask = ref.putFile(_secilenresim);
var downloadUrl = await uploadTask.snapshot.ref.getDownloadURL();
debugPrint(downloadUrl.toString());
kodları ile kalfa isimli resmimi firebase’ e upload edebiliyor ve downloadUrl i alabiliyorum. AMA
`String imageFileName = DateTime.now().millisecondsSinceEpoch.toString();
final Reference ref = await FirebaseStorage.instance.ref().child(“deneme”).child(“resimler”).child(imageFileName );
UploadTask uploadTask = ref.putFile(_secilenresim);
var downloadUrl = await uploadTask.snapshot.ref.getDownloadURL();
debugPrint(downloadUrl.toString());`
yaparsam resmi yükeleyebildiğim halde DownloadUrl alamıyorum. konsolda hata mesajı olarak:
E/flutter (26324): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: [firebase_storage/object-not-found] No object exists at the desired reference.
E/flutter (26324): #0 MethodChannelReference.getDownloadURL (package:firebase_storage_platform_interface/src/method_channel/method_channel_reference.dart:57:7)
E/flutter (26324): <asynchronous suspension>
E/flutter (26324): #1 Reference.getDownloadURL (package:firebase_storage/src/reference.dart:94:48)
E/flutter (26324): #2 ImageUploadPageState._resimYukle (package:firebase/ImageUploadPage.dart:55:53)
E/flutter (26324): #3 _rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter (26324): #4 _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (26324): #5 _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
E/flutter (26324): #6 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
E/flutter (26324): #7 Future._propagateToListeners (dart:async/future_impl.dart:725:32)
E/flutter (26324): #8 Future._addListener.<anonymous closure> (dart:async/future_impl.dart:393:9)
E/flutter (26324): #9 _rootRun (dart:async/zone.dart:1190:13)
E/flutter (26324): #10 _CustomZone.run (dart:async/zone.dart:1093:19)
E/flutter (26324): #11 _CustomZone.runGuarded (dart:async/zone.dart:997:7)
E/flutter (26324): #12 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
E/flutter (26324): #13 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter (26324): #14 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
E/flutter (26324):
bunları alıyorum. burada imageFileName String olarak tanımlı olduğundan hata vermemesi gerekiyor. teknik olarak kalfa yazandan hiç bir farkı yok. bir de istenen referansta obje yok diyor. halbuki resim Firebase’ e kaydedildi. anlayamadım.