firebase-storage

Integrates Firebase Cloud Storage into Flutter apps. Use when setting up Storage, uploading or downloading files, managing metadata, handling errors, or applying security rules.

520 stars

Best use case

firebase-storage is best used when you need a repeatable AI agent workflow instead of a one-off prompt. It is especially useful for teams working in multi. Integrates Firebase Cloud Storage into Flutter apps. Use when setting up Storage, uploading or downloading files, managing metadata, handling errors, or applying security rules.

Integrates Firebase Cloud Storage into Flutter apps. Use when setting up Storage, uploading or downloading files, managing metadata, handling errors, or applying security rules.

Users should expect a more consistent workflow output, faster repeated execution, and less time spent rewriting prompts from scratch.

Practical example

Example input

Use the "firebase-storage" skill to help with this workflow task. Context: Integrates Firebase Cloud Storage into Flutter apps. Use when setting up Storage, uploading or downloading files, managing metadata, handling errors, or applying security rules.

Example output

A structured workflow result with clearer steps, more consistent formatting, and an output that is easier to reuse in the next run.

When to use this skill

  • Use this skill when you want a reusable workflow rather than writing the same prompt again and again.

When not to use this skill

  • Do not use this when you only need a one-off answer and do not need a reusable workflow.
  • Do not use it if you cannot install or maintain the related files, repository context, or supporting tools.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/firebase-storage/SKILL.md --create-dirs "https://raw.githubusercontent.com/evanca/flutter-ai-rules/main/skills/firebase-storage/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/firebase-storage/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How firebase-storage Compares

Feature / Agentfirebase-storageStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Integrates Firebase Cloud Storage into Flutter apps. Use when setting up Storage, uploading or downloading files, managing metadata, handling errors, or applying security rules.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 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);
```

Use **custom metadata** to store additional key/value pairs with your files.

---

## 4. Error Handling

Use `try-catch` with `FirebaseException`. Key error codes:

| Code | Meaning |
|---|---|
| `storage/object-not-found` | File doesn't exist at the reference |
| `storage/bucket-not-found` | No bucket configured for Cloud Storage |
| `storage/project-not-found` | No project configured for Cloud Storage |
| `storage/quota-exceeded` | Storage quota exceeded |
| `storage/unauthenticated` | User needs to authenticate |
| `storage/unauthorized` | User lacks permission |
| `storage/retry-limit-exceeded` | Operation timeout exceeded |

- For `quota-exceeded` on the Spark plan, upgrade to Blaze.
- Implement retry logic for network-related errors and timeouts.

---

## 5. Performance and Best Practices

**Monitor upload progress:**

```dart
final uploadTask = fileRef.putFile(file);
uploadTask.snapshotEvents.listen((TaskSnapshot snapshot) {
  print('Progress: ${(snapshot.bytesTransferred / snapshot.totalBytes) * 100}%');
});
```

- **Cancel** uploads with `uploadTask.cancel()`.
- **Pause / resume** with `uploadTask.pause()` and `uploadTask.resume()`.
- Optimize file sizes before upload to reduce costs and improve performance.
- Use Cloud Storage with Firestore for comprehensive data management.
- Use the **Firebase Local Emulator Suite** for local development and testing.

---

## 6. Security

- Use **Firebase Security Rules** to control access to files.
- Combine Storage rules with **Firebase Authentication** for user-based access control.
- Test security rules thoroughly before deploying to production.

---

## References

- [Firebase Cloud Storage Flutter documentation](https://firebase.google.com/docs/storage/flutter/start)
- [Upload files](https://firebase.google.com/docs/storage/flutter/upload-files)
- [Download files](https://firebase.google.com/docs/storage/flutter/download-files)
- [Handle errors](https://firebase.google.com/docs/storage/flutter/handle-errors)

Related Skills

firebase-remote-config

520
from evanca/flutter-ai-rules

Integrates Firebase Remote Config into Flutter apps. Use when setting up Remote Config, managing parameter defaults, fetching and activating values, implementing real-time updates, or handling throttling and testing.

firebase-messaging

520
from evanca/flutter-ai-rules

Integrates Firebase Cloud Messaging (FCM) into Flutter apps. Use when setting up push notifications, handling foreground/background messages, managing permissions, working with FCM tokens, or configuring platform-specific notification behavior.

firebase-in-app-messaging

520
from evanca/flutter-ai-rules

Integrates Firebase In-App Messaging into Flutter apps. Use when setting up in-app messaging, triggering or suppressing messages, managing user privacy and opt-in data collection, or testing campaigns.

firebase-database

520
from evanca/flutter-ai-rules

Integrates Firebase Realtime Database into Flutter apps. Use when setting up Realtime Database, structuring JSON data, querying, performing read/write operations, implementing offline capabilities, or applying security rules.

firebase-data-connect

520
from evanca/flutter-ai-rules

Integrates Firebase Data Connect into Flutter apps. Use when setting up Data Connect, designing queries, handling errors, or applying security and performance best practices.

firebase-crashlytics

520
from evanca/flutter-ai-rules

Integrates Firebase Crashlytics into Flutter apps. Use when setting up crash reporting, handling fatal and non-fatal errors, customizing crash reports with keys/logs/user identifiers, or configuring opt-in reporting.

firebase-cloud-functions

520
from evanca/flutter-ai-rules

Calls Firebase Cloud Functions from Flutter apps. Use when setting up callable functions, passing data to functions, handling errors from function calls, optimizing performance, or testing with the Firebase Emulator Suite.

firebase-cloud-firestore

520
from evanca/flutter-ai-rules

Integrates Cloud Firestore into Flutter apps. Use when setting up Firestore, designing document/collection structure, reading and writing data, working with real-time listeners, designing for scale, or applying security rules.

firebase-auth

520
from evanca/flutter-ai-rules

Integrates Firebase Authentication into Flutter apps. Use when setting up auth, managing auth state, implementing email/password or social sign-in, handling auth errors, managing users, or applying security best practices.

firebase-app-check

520
from evanca/flutter-ai-rules

Integrates Firebase App Check into Flutter apps. Use when setting up App Check, selecting providers per platform, using debug providers during development, enabling enforcement, or applying App Check security best practices.

firebase-analytics

520
from evanca/flutter-ai-rules

Integrates Firebase Analytics into Flutter apps. Use when setting up analytics, logging events, setting user properties, or configuring event parameters.

firebase-ai

520
from evanca/flutter-ai-rules

Integrates Firebase AI Logic into Flutter apps. Use when setting up the firebase_ai plugin, calling Gemini models, handling AI service errors, or applying security and privacy considerations for AI features.