从Flutter中的设备上的Firebase存储下载并存储文件会引发错误

问题描述

我正在尝试通过Flutter将excel文件从firebaseStorage下载到我的设备上。 我收到我的文件不存在但确实存在的错误

    // Creating a temp directory,file and the file path

    final String filePath = 'excels/2020-8-10.xlsx';
    final Directory tempDir = Directory.systemTemp;
    final File file = File('${tempDir.path}/$filePath');

    // Accessing the file in the FirebaseStorage

    StorageReference ref =
        FirebaseStorage.instance.ref().child(filePath);

    // Writing to the prevIoUsly created file from the file in the FirebaseStorage

    final StorageFileDownloadTask downloadTask = ref.writetoFile(file);

    // Await till the file is completly written by counting the total bytes

    final int byteNumber = (await downloadTask.future).totalByteCount;
    print(byteNumber);

这是我得到的错误

  Exception has occurred.
    PlatformException (PlatformException(download_error,An unkNown error occurred,please check the HTTP result code and inner exception for server response.,null))
E/StorageException(10217): No such file or directory

这是我的FirebaseStorage:

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)