我是Firebase的新手,我无法弄清楚我应该将什么样的参数传递给putfile中的以下代码,并且有关带抖动的Firebase是否有任何教程或适当的文档?
final FirebaseStorage _storage = FirebaseStorage(storageBucket:"https://console.firebase.google.com/project/blalala/storage/blBLlabla4ef54.appspot.com");
StorageUploadTask _uploadTask;
void firebasebackend(){
String filePath = "images/ts2.jpg";
setState(() {
_uploadTask = _storage.ref().child(filePath).putFile("What shud i pass here?");
});
}
根据firebase_storage
插件的代码:
/// Asynchronously uploads a file to the currently specified
/// [StorageReference], with an optional [metadata].
StorageUploadTask putFile(File file, [StorageMetadata metadata]) {
assert(file.existsSync());
final _StorageFileUploadTask task =
_StorageFileUploadTask._(file, _firebaseStorage, this, metadata);
task._start();
return task;
}
将file
作为参数,将类型为StorageMetadata
的变量作为可选参数。