uploadImages(XFile? pathsw) async {
final paths = path.basename(pathsw!.path);
final pathStorage =
"${NAMEFOLDER}/${PATHNAME}/$paths";
/// Start looking from here then so on
final file = File(pathsw.path);
final reference = FirestoreService.storage.ref().child(pathStorage);
final task = reference.putFile(file);
final snap = await task.whenComplete(() {});
final url = await snap.ref.getDownloadURL();
return url;
}
2
Answers
try this convert that xfile to file
If you see,
.putFile()
takes in a element ofFile
type. And you’re accepting of typeXFile
. To convert:now the best way to upload would be to use
.putFile()
or.putData()
Your
.putFile()
implementation looks great, if you want to use.putData()
, find the following code: