diff --git a/lib/src/cache_manager.dart b/lib/src/cache_manager.dart index ce3d733..80bbc24 100644 --- a/lib/src/cache_manager.dart +++ b/lib/src/cache_manager.dart @@ -100,17 +100,16 @@ class FirebaseImageCacheManager { return null; } - StorageReference getImageRef( - FirebaseImageObject object, FirebaseApp firebaseApp) { + Reference getImageRef(FirebaseImageObject object, FirebaseApp firebaseApp) { FirebaseStorage storage = - FirebaseStorage(app: firebaseApp, storageBucket: object.bucket); + FirebaseStorage.instanceFor(app: firebaseApp, bucket: object.bucket); return storage.ref().child(object.remotePath); } Future checkForUpdate( FirebaseImageObject object, FirebaseImage image) async { int remoteVersion = - (await object.reference.getMetadata()).updatedTimeMillis; + (await object.reference.getMetadata()).updated.millisecondsSinceEpoch; if (remoteVersion != object.version) { // If true, download new image for next load await this.upsertRemoteFileToCache(object, image.maxSizeBytes); @@ -147,7 +146,8 @@ class FirebaseImageCacheManager { Future upsertRemoteFileToCache( FirebaseImageObject object, int maxSizeBytes) async { if (CacheRefreshStrategy.BY_METADATA_DATE == this.cacheRefreshStrategy) { - object.version = (await object.reference.getMetadata()).updatedTimeMillis; + object.version = + (await object.reference.getMetadata()).updated.millisecondsSinceEpoch; } Uint8List bytes = await remoteFileBytes(object, maxSizeBytes); await putFile(object, bytes); diff --git a/lib/src/firebase_image.dart b/lib/src/firebase_image.dart index 8212a01..1c22f03 100644 --- a/lib/src/firebase_image.dart +++ b/lib/src/firebase_image.dart @@ -64,10 +64,9 @@ class FirebaseImage extends ImageProvider { return uri.path; } - static StorageReference _getImageRef( - String location, FirebaseApp firebaseApp) { - FirebaseStorage storage = - FirebaseStorage(app: firebaseApp, storageBucket: _getBucket(location)); + static Reference _getImageRef(String location, FirebaseApp firebaseApp) { + FirebaseStorage storage = FirebaseStorage.instanceFor( + app: firebaseApp, bucket: _getBucket(location)); return storage.ref().child(_getImagePath(location)); } diff --git a/lib/src/image_object.dart b/lib/src/image_object.dart index 12a5d1f..97ab49e 100644 --- a/lib/src/image_object.dart +++ b/lib/src/image_object.dart @@ -2,7 +2,7 @@ import 'package:firebase_storage/firebase_storage.dart'; class FirebaseImageObject { int version; - StorageReference reference; + Reference reference; String localPath; final String remotePath; final String bucket; diff --git a/pubspec.lock b/pubspec.lock index bc8e309..e707945 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,49 +7,56 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.2" + version: "2.5.0-nullsafety.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.1.0-nullsafety.3" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.3" + version: "1.2.0-nullsafety.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.1.0-nullsafety.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.13" + version: "1.15.0-nullsafety.3" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0-nullsafety.1" + ffi: + dependency: transitive + description: + name: ffi + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3" file: dependency: transitive description: @@ -63,14 +70,14 @@ packages: name: firebase url: "https://pub.dartlang.org" source: hosted - version: "7.3.0" + version: "7.3.2" firebase_core: dependency: "direct main" description: name: firebase_core url: "https://pub.dartlang.org" source: hosted - version: "0.5.0" + version: "0.5.1" firebase_core_platform_interface: dependency: transitive description: @@ -91,7 +98,14 @@ packages: name: firebase_storage url: "https://pub.dartlang.org" source: hosted - version: "4.0.0" + version: "5.0.0" + firebase_storage_platform_interface: + dependency: transitive + description: + name: firebase_storage_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" flutter: dependency: "direct main" description: flutter @@ -141,28 +155,28 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.8" + version: "0.12.10-nullsafety.1" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.8" + version: "1.3.0-nullsafety.3" path: dependency: "direct main" description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0-nullsafety.1" path_provider: dependency: "direct main" description: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "1.6.11" + version: "1.6.24" path_provider_linux: dependency: transitive description: @@ -176,21 +190,28 @@ packages: name: path_provider_macos url: "https://pub.dartlang.org" source: hosted - version: "0.0.4+3" + version: "0.0.4+6" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "1.0.4" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.4+3" pedantic: dependency: transitive description: name: pedantic url: "https://pub.dartlang.org" source: hosted - version: "1.9.0" + version: "1.9.2" platform: dependency: transitive description: @@ -204,7 +225,7 @@ packages: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.2" + version: "1.0.3" process: dependency: transitive description: @@ -218,7 +239,7 @@ packages: name: quiver url: "https://pub.dartlang.org" source: hosted - version: "2.1.3" + version: "2.1.4+1" sky_engine: dependency: transitive description: flutter @@ -230,14 +251,14 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0-nullsafety.2" sqflite: dependency: "direct main" description: name: sqflite url: "https://pub.dartlang.org" source: hosted - version: "1.3.1" + version: "1.3.2+1" sqflite_common: dependency: transitive description: @@ -251,21 +272,21 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.5" + version: "1.10.0-nullsafety.1" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0-nullsafety.1" synchronized: dependency: transitive description: @@ -279,35 +300,42 @@ packages: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0-nullsafety.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.17" + version: "0.2.19-nullsafety.2" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0-nullsafety.3" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.0-nullsafety.3" + win32: + dependency: transitive + description: + name: win32 + url: "https://pub.dartlang.org" + source: hosted + version: "1.7.3" xdg_directories: dependency: transitive description: name: xdg_directories url: "https://pub.dartlang.org" source: hosted - version: "0.1.0" + version: "0.1.2" sdks: - dart: ">=2.9.0-14.0.dev <3.0.0" - flutter: ">=1.12.13+hotfix.5 <2.0.0" + dart: ">=2.10.2 <2.11.0" + flutter: ">=1.22.2 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 2e4b46c..222c444 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,10 +11,10 @@ dependencies: sdk: flutter firebase_core: ^0.5.0 - firebase_storage: ^4.0.0 - sqflite: ^1.3.1 + firebase_storage: ^5.0.0 + sqflite: ^1.3.2+1 path: ^1.7.0 - path_provider: ^1.6.11 + path_provider: ^1.6.24 dev_dependencies: flutter_test: