Skip to content

Using Firebase Storage

The storage module uses Firebase Storage to store files in the cloud. It is a simple, roboust and cost-effective way to store files in the cloud.

Setup

  1. Create a default Cloud Storage bucket in the console (more info)

  2. Deploy the default storage.rules

    Terminal window
    firebase deploy --only storage

Similar to other Firebase modules, when deploying the rules it will override any existing rules in the Firebase console. Make sure to only edit the storage.rules file in your project directory or copy the existing rules from the consoele.

The basics

To learn how to use Firebase Storage, we recommend checking the official documentation. ShipFlutter provides the following files, showcasing a common use case to upload a user avatar:

  • Directorylib/modules/storage
    • storage_service.dart Commuinicates with the SDK
    • storage_controller.dart Handles the business logic
    • storage_view.dart Displays the user avatar from the storage url
    • storage_route.dart