This page is archived and might not reflect the latest version of the FlutterFire plugins. You can find the latest information on firebase.google.com:
After uploading a file to Cloud Storage reference, you can also get and update the file metadata, for example to view or update the content type. Files can also store custom key/value pairs with additional file metadata.
By default, a Cloud Storage bucket requires Firebase Authentication to perform any action on the bucket's data or files. You can change your Firebase Security Rules for Cloud Storage to allow unauthenticated access. Since Firebase and your project's default App Engine app share this bucket, configuring public access may make newly uploaded App Engine files publicly accessible, as well. Be sure to restrict access to your Cloud Storage bucket again when you set up Authentication.
File metadata contains common properties such as
contentType (often referred to as MIME type) in addition to some less
common ones like
timeCreated. This metadata can be
retrieved from a Cloud Storage reference using
You can update file metadata at any time after the file upload completes by
updateMetadata() method. Refer to the
full list for more information on what properties
can be updated. Only the properties specified in the metadata are updated,
all others are left unmodified.
You can delete writable metadata properties by passing
There are a number of reasons why errors may occur on getting or updating metadata, including the file not existing, or the user not having permission to access the desired file. More information on errors can be found in the Handle Errors section of the docs.
You can specify custom metadata using the
customMetadata parameter of the
You can store app-specific data for each file in custom metadata, but we highly recommend using a database (such as the Firebase Realtime Database) to store and synchronize this type of data.
A full list of metadata properties on a file is available below:
Uploading, downloading, and updating files is important, but so is being able to remove them. Let's learn how to delete files from Cloud Storage.