我从 Flutter 项目将图像上传到 Fireabse Storage,这是我的代码。
return storageRef
.ref(profileDir)
.child("${DateTime.now().millisecondsSinceEpoch}.png")
.putFile(profilePhoto)
.then((taskSnapshot) => taskSnapshot.ref.getDownloadURL());
但是在firebase Storage中,类型没有出现,我怎样才能显示类型。
您应该能够设置文件的元数据。如果没有这个,文件存储默认为
application/octet-stream
。例如:
.putFile(profilePhoto, SettableMetadata(contentType: 'image/png'))