Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/firebase_storage/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 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 `README.md` to explain the above.

## 3.0.4

* Update google-services Android gradle plugin to 4.3.0 in documentation and examples.
Expand Down
26 changes: 26 additions & 0 deletions packages/firebase_storage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,34 @@ For Flutter plugins for other Firebase products, see [FlutterFire.md](https://gi
*Note*: This plugin is still under development, and some APIs might not be available yet. [Feedback](https://github.com/flutter/flutter/issues) and [Pull Requests](https://github.com/flutter/plugins/pulls) are most welcome!

## Usage

To use this plugin, add `firebase_storage` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/).

### Logging

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

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

final StorageUploadTask uploadTask = storageReference.putData(data);

final StreamSubscription<StorageTaskEvent> streamSubscription = uploadTask.events.listen((event) {
// You can use this to notify yourself or your user in any kind of way.
// For example: you could use the uploadTask.events 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;
streamSubscription.cancel();
```

## Getting Started

See the `example` directory for a complete sample app using Firebase Cloud Storage.
1 change: 0 additions & 1 deletion packages/firebase_storage/lib/src/upload_task.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ abstract class StorageUploadTask {

void _changeState(StorageTaskEvent event) {
_resetState();
print('EVENT ${event.type}');
switch (event.type) {
case StorageTaskEventType.progress:
isInProgress = true;
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase_storage/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Flutter plugin for Firebase Cloud Storage, a powerful, simple, and
cost-effective object storage service for Android and iOS.
author: Flutter Team <flutter-dev@googlegroups.com>
homepage: https://github.com/flutter/plugins/tree/master/packages/firebase_storage
version: 3.0.4
version: 3.0.5

flutter:
plugin:
Expand Down