firebase_storage 3.1.1

Firebase Cloud Storage for Flutter #

pub package

A Flutter plugin to use the Firebase Cloud Storage API.

For Flutter plugins for other Firebase products, see

Usage #

To use this plugin, add firebase_storage as a dependency in your pubspec.yaml file.

Logging #

If you wish to see status events for your upload tasks in your logs, you should listen to the stream.
This could look like the following if you are using StorageReference.putData:

final StorageReference storageReference = FirebaseStorage().ref().child(path);

final StorageUploadTask uploadTask = storageReference.putData(data);

final StreamSubscription<StorageTaskEvent> streamSubscription = {
  // You can use this to notify yourself or your user in any kind of way.
  // For example: you could use the stream in a StreamBuilder instead
  // to show your user what the current status is. In that case, you would not need to cancel any
  // subscription as StreamBuilder handles this automatically.

  // Here, every StorageTaskEvent concerning the upload is printed to the logs.
  print('EVENT ${event.type}');

// Cancel your subscription when done.
await uploadTask.onComplete;

Getting Started #

See the example directory for a complete sample app using Firebase Cloud Storage.

Issues and feedback #

Please file Flutterfire specific issues, bugs, or feature requests in our issue tracker.

Plugin issues that are not specific to Flutterfire can be filed in the Flutter issue tracker.

To contribute a change to this plugin, please review our contribution guide, and send a pull request.

3.1.1 #

  • Removed unnecessary debug print statements ("i am working").

3.1.0 #

  • Added error handling to StorageFileDownloadTask and added propagation of errors to the Future returned by the writeToFile method in StorageReference.
  • Added unit tests for writeToFile.
  • Updated integration test in example to use proper error handling.

3.0.11 #

  • Remove the deprecated author: field from pubspec.yaml
  • Migrate the plugin to the pubspec platforms manifest.
  • Bump the minimum Flutter version to 1.10.0.

3.0.10 #

  • Fix example app by adding a call to ensureInitialized.

3.0.9 #

  • Support the v2 Android embedding.

3.0.8 #

  • Updated README instructions for contributing for consistency with other Flutterfire plugins.

3.0.7 #

  • Remove AndroidX warning.

3.0.6 #

  • Update documentation to reflect new repository location.
  • Update unit tests to call TestWidgetsFlutterBinding.ensureInitialized.
  • Remove executable bit on LICENSE file.

3.0.5 #

  • Removed automatic print statements for StorageTaskEvent's. If you want to see the event status in your logs now, you will have to use the following: storageReference.put{File/Data}(..).events.listen((event) => print('EVENT ${event.type}'));
  • Updated to explain the above.

3.0.4 #

  • Update google-services Android gradle plugin to 4.3.0 in documentation and examples.

3.0.3 #

  • Fix inconsistency of getPath, on Android the path returned started with a / but on iOS it did not
  • Fix content-type auto-detection on Android

3.0.2 #

  • Automatically use version from pubspec.yaml when reporting usage to Firebase.

3.0.1 #

  • Add missing template type parameter to invokeMethod calls.
  • Bump minimum Flutter version to 1.5.0.
  • Replace invokeMethod with invokeMapMethod wherever necessary.

3.0.0 #

  • Update Android dependencies to latest.

2.1.1+2 #

  • On iOS, use putFile instead of putData appropriately to detect Content-Type.

2.1.1+1 #

  • On iOS, gracefully handle the case of uploading a nonexistent file without crashing.

2.1.1 #

  • Added integration tests.

2.1.0+1 #

  • Reverting error.code casting/formatting to what it was until version 2.0.1.

2.1.0 #

  • Added support for getReferenceFromUrl.

2.0.1+2 #

  • Log messages about automatic configuration of the default app are now less confusing.

2.0.1+1 #

  • Remove categories.

2.0.1 #

  • Log a more detailed warning at build time about the previous AndroidX migration.

2.0.0 #

  • Breaking change. Migrate from the deprecated original Android Support Library to AndroidX. This shouldn't result in any functional changes, but it requires any Android apps using this plugin to also migrate if they're using the original support library.

    This was originally incorrectly pushed in the 1.1.0 update.

1.1.0+1 #

  • Revert the breaking 1.1.0 update. 1.1.0 was known to be breaking and should have incremented the major version number instead of the minor. This revert is in and of itself breaking for anyone that has already migrated however. Anyone who has already migrated their app to AndroidX should immediately update to 2.0.0 instead. That's the correctly versioned new push of 1.1.0.

1.1.0 #

  • BAD. This was a breaking change that was incorrectly published on a minor version upgrade, should never have happened. Reverted by 1.1.0+1.

  • Breaking change. Migrate from the deprecated original Android Support Library to AndroidX. This shouldn't result in any functional changes, but it requires any Android apps using this plugin to also migrate if they're using the original support library.

1.0.4 #

  • Bump Android dependencies to latest.

1.0.3 #

  • Added monitoring of StorageUploadTask via events stream.
  • Added support for StorageUploadTask functions: pause, resume, cancel.
  • Set http version to be compatible with flutter_test.

1.0.2 #

  • Added missing http package dependency.

1.0.1 #

  • Bump Android and Firebase dependency versions.

1.0.0 #

  • Breaking change. Make StorageUploadTask implementation classes private.
  • Bump to released version

0.3.7 #

  • Updated Gradle tooling to match Android Studio 3.1.2.

0.3.6 #

  • Added support for custom metadata.

0.3.5 #

  • Updated iOS implementation to reflect Firebase API changes.

0.3.4 #

  • Added timeout properties to FirebaseStorage.

0.3.3 #

  • Added support for initialization with a custom Firebase app.

0.3.2 #

  • Added support for StorageReference writeToFile.

0.3.1 #

  • Added support for StorageReference functions: getParent, getRoot, getStorage, getName, getPath, getBucket.

0.3.0 #

  • Breaking change. Changed StorageUploadTask to abstract, removed the 'file' field, and made 'path' and 'metadata' private. Added two subclasses: StorageFileUploadTask and StorageDataUploadTask.
  • Deprecated the put function and added putFile and putData to upload files and bytes respectively.

0.2.6 #

  • Added support for updateMetadata.

0.2.5 #

  • Added StorageMetadata class, support for getMetadata, and support for uploading file with metadata.

0.2.4 #

  • Updated Google Play Services dependencies to version 15.0.0.

0.2.3 #

  • Updated package channel name and made channel visible for testing

0.2.2 #

  • Simplified podspec for Cocoapods 1.5.0, avoiding link issues in app archives.

0.2.1 #

  • Added support for getDownloadUrl.

0.2.0 #

  • Breaking change. Set SDK constraints to match the Flutter beta release.

0.1.5 #

  • Fix Dart 2 type errors.

0.1.4 #

  • Enabled use in Swift projects.

0.1.3 #

  • Added StorageReference path getter to retrieve the path component for the storage node.

0.1.2 #

  • Added StorageReference delete function to remove files from Firebase.

0.1.1 #

  • Simplified and upgraded Android project template to Android SDK 27.
  • Updated package description.

0.1.0 #

  • Breaking change. Upgraded to Gradle 4.1 and Android Studio Gradle plugin 3.0.1. Older Flutter projects need to upgrade their Gradle setup as well in order to use this version of the plugin. Instructions can be found here.
  • Relaxed GMS dependency to [11.4.0,12.0[

0.0.8 #

  • Added FLT prefix to iOS types
  • Change GMS dependency to 11.4.+

0.0.7 #

  • Change GMS dependency to 11.+

0.0.6 #

  • Added StorageReference getData function to download files into memory.

0.0.5+1 #

  • Aligned author name with rest of repo.

0.0.5 #

  • Updated to Firebase SDK to always use latest patch version for 11.0.x builds
  • Fix crash when encountering upload failure

0.0.4 #

  • Updated to Firebase SDK Version 11.0.1

0.0.3 #

  • Suppress unchecked warnings

0.0.2 #

  • Bumped buildToolsVersion to 25.0.3
  • Updated README

0.0.1 #

  • Initial Release


firebase_storage_example #

Demonstrates how to use the firebase_storage plugin.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  firebase_storage: ^3.1.1

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:firebase_storage/firebase_storage.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Feb 24, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.7


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
firebase_core ^0.4.0 0.4.4
flutter 0.0.0
Transitive dependencies
async 2.4.0
charcode 1.1.3
collection 1.14.11 1.14.12
firebase 7.2.1
firebase_core_platform_interface 1.0.2
firebase_core_web 0.1.1+2
flutter_web_plugins 0.0.0
http_parser 3.1.3
js 0.6.1+1
matcher 0.12.6
meta 1.1.8
path 1.6.4
pedantic 1.9.0
quiver 2.1.2+1
sky_engine 0.0.99
source_span 1.6.0
stack_trace 1.9.3
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
e2e ^0.2.1
http ^0.12.0 0.12.0+4
test any
uuid ^1.0.0