# Firebase Storage

Use when setting up Storage, uploading/downloading files, managing metadata, handling...

- Repository: https://github.com/evanca/flutter-ai-rules (668 stars)
- Category: Security
- License: MIT
- Last updated: 2026-10-30
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add evanca/flutter-ai-rules --skill firebase-storage -g -a claude-code -y`
Codex: `npx skills add evanca/flutter-ai-rules --skill firebase-storage -g -a codex -y`
Cursor: `npx skills add evanca/flutter-ai-rules --skill firebase-storage -g -a cursor -y`
Gemini CLI: `npx skills add evanca/flutter-ai-rules --skill firebase-storage -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add evanca/flutter-ai-rules`

## Description

Use when setting up Storage, uploading/downloading files, managing metadata, handling errors, or applying security rules.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Firebase Cloud Storage Skill

This skill defines how to correctly use Firebase Cloud Storage in Flutter applications.

## When to Use

Use this skill when:

* Setting up Cloud Storage in a Flutter project.
* Uploading or downloading files.
* Managing file metadata.
* Handling Storage errors and monitoring upload progress.

---

## 1. Setup and Configuration

```
flutter pub add firebase_storage
```

```dart
import 'package:firebase_storage/firebase_storage.dart';

final storage = FirebaseStorage.instance;
// Or specify a bucket explicitly:
// final storage = FirebaseStorage.instanceFor(bucket: "gs://BUCKET_NAME");
```

- Firebase Storage requires the **Blaze (pay-as-you-go) plan**.
- Run `flutterfire configure` to update your Firebase config with the default Storage bucket name.

> **Security note:** By default, a Cloud Storage bucket requires Firebase Authentication for any action. Configuring public access may also make App Engine files publicly accessible, restrict access again when you set up Authentication.

---

## 2. File Operations

**Create a reference:**

```dart
final storageRef = FirebaseStorage.instance.ref();
final fileRef = storageRef.child("uploads/file.jpg");
```

**Upload:**

```dart
final uploadTask = fileRef.putFile(file);
final snapshot = await uploadTask;
final downloadUrl = await snapshot.ref.getDownloadURL();
```

**Download (in-memory):**

```dart
final data = await fileRef.getData();
```

**Download URL:**

```dart
final downloadUrl = await fileRef.getDownloadURL();
```

**Delete:**

```dart
await fileRef.delete();
```

---

## 3. Metadata Management

**Get metadata:**

```dart
final metadata = await fileRef.getMetadata();
print('Content type: ${metadata.contentType}');
print('Size: ${metadata.size}');
```

**Update metadata:**

```dart
final newMetadata = SettableMetadata(
  contentType: "image/jpeg",
  customMetadata: {'uploaded_by': 'user123'},
);
await fileRef.updateMetadata(newMetadata);
```

The rest: https://github.com/evanca/flutter-ai-rules/blob/HEAD/skills/firebase-storage/SKILL.md
