Added uuid as a dependency to generate the ids of the uploaded files
This commit is contained in:
parent
324eba55d9
commit
089548b492
2 changed files with 20 additions and 1 deletions
|
|
@ -1,4 +1,22 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:'
|
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}) {}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ dependencies:
|
||||||
mockito: ^4.0.0
|
mockito: ^4.0.0
|
||||||
rxdart: ^0.20.0
|
rxdart: ^0.20.0
|
||||||
sqflite: ^1.1.0
|
sqflite: ^1.1.0
|
||||||
|
uuid: ^2.0.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue