firebase_storage_web 3.7.0 copy "firebase_storage_web: ^3.7.0" to clipboard
firebase_storage_web: ^3.7.0 copied to clipboard


The web implementation of firebase_storage

firebase_storage_web #

The web implementation of firebase_storage.

Getting Started #

To get started with Firebase Storage, please see the documentation

To learn more about Firebase Storage, please visit the Firebase website

Downloading files with getData() #

When using Reference::getData() in the web platform, your bucket must have the correct CORS configuration, or the security mechanisms in the browser will not let you access the downloaded data, with exceptions similar to:

Access to XMLHttpRequest at '' from origin '' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
browser_client.dart:87 GET net::ERR_FAILED


Error: XMLHttpRequest error.
    dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 894:28                get current
packages/http/src/browser_client.dart 84:22                                       <fn>

You need to enable CORS response headers in your Google Cloud Storage Bucket, as described in the following document:

In the example app, ensure there's a cors.json file:

firebase_storage/example$ cat cors.json
    "origin": ["*"],
    "method": ["GET"],
    "maxAgeSeconds": 3600

And then, with gsutil:

firebase_storage/example$ gsutil cors set cors.json gs://
Setting CORS on gs://

For much, much more information about CORS in Google Cloud Platform, see: