From 089548b492a07f3294939c586eec719f76023724 Mon Sep 17 00:00:00 2001 From: AYM1607 Date: Wed, 27 Feb 2019 16:41:55 -0600 Subject: [PATCH] Added uuid as a dependency to generate the ids of the uploaded files --- .../resources/firebase_storage_provider.dart | 20 ++++++++++++++++++- pubspec.yaml | 1 + 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/src/resources/firebase_storage_provider.dart b/lib/src/resources/firebase_storage_provider.dart index e45f9c5..8d043ce 100644 --- a/lib/src/resources/firebase_storage_provider.dart +++ b/lib/src/resources/firebase_storage_provider.dart @@ -1,4 +1,22 @@ import 'dart:async'; import 'dart:io'; -import 'package:' \ No newline at end of file +import 'package:firebase_storage/firebase_storage.dart'; +import 'package:uuid/uuid.dart'; + +class FirebaseStorageProvider { + final FirebaseStorage _storage; + final Uuid _uuid; + // [FirebaseStorage] and [Uuid] instances can be injected for testing purposes. + // Don't remove. + FirebaseStorageProvider([FirebaseStorage storage, Uuid uuid]) + : _storage = storage ?? FirebaseStorage.instance, + _uuid = uuid ?? Uuid(); + + /// Uploads a given file to the firebase storage bucket. + /// + /// It returns a [StorageUploadTask] which contains the status of the upload. + /// The [folder] parameters allows the file to be stored at any path in the + /// bucket. + StorageUploadTask uploadFile(File file, {String folder}) {} +} diff --git a/pubspec.yaml b/pubspec.yaml index c958b3f..ce4e226 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -31,6 +31,7 @@ dependencies: mockito: ^4.0.0 rxdart: ^0.20.0 sqflite: ^1.1.0 + uuid: ^2.0.0 dev_dependencies: flutter_test: