我正在制作一個具有影像上傳功能但無法上傳到 firebase 資料庫的應用程式。以下是我制作的圖片上傳代碼
Future pickImage(ImageSource source) async {
try {
final image = await ImagePicker().pickImage(source: source);
if(image == null) return;
final imageTemporary = File(image.path);
Reference ref = await storage.ref().child(imageTemporary.toString());
UploadTask uploadTask = ref.putFile(imageTemporary);
uploadTask.then((res) {
res.ref.getDownloadURL();
});
setState(() => this.image = imageTemporary);
} on PlatformException catch(e) {
print('failed to pick image');
}
}
uj5u.com熱心網友回復:
如果您只是第一次設定插件并且您只是重新加載或重新運行您的應用程式,則會發生上述情況。
所以你必須先卸載你的應用程式,然后重新安裝你的應用程式。
/android/app/build.gradle
android {
buildTypes {
release {
// other stuff
shrinkResources false
minifyEnabled false
}
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/311250.html
上一篇:無法為公共抽象org.springframework.data.domain.Pagecom.example.repository.DocumentsRepository.findBytypeid創建
