diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies new file mode 100644 index 0000000..aa4ea26 --- /dev/null +++ b/.flutter-plugins-dependencies @@ -0,0 +1 @@ +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"firebase_core","path":"C:\\\\Users\\\\AshwaniKumar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\firebase_core-3.1.0\\\\","native_build":true,"dependencies":[]},{"name":"firebase_storage","path":"C:\\\\Users\\\\AshwaniKumar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\firebase_storage-12.0.1\\\\","native_build":true,"dependencies":["firebase_core"]},{"name":"path_provider_foundation","path":"C:\\\\Users\\\\AshwaniKumar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\AshwaniKumar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\sqflite-2.3.3+1\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"firebase_core","path":"C:\\\\Users\\\\AshwaniKumar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\firebase_core-3.1.0\\\\","native_build":true,"dependencies":[]},{"name":"firebase_storage","path":"C:\\\\Users\\\\AshwaniKumar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\firebase_storage-12.0.1\\\\","native_build":true,"dependencies":["firebase_core"]},{"name":"path_provider_android","path":"C:\\\\Users\\\\AshwaniKumar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.2.6\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\AshwaniKumar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\sqflite-2.3.3+1\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"firebase_core","path":"C:\\\\Users\\\\AshwaniKumar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\firebase_core-3.1.0\\\\","native_build":true,"dependencies":[]},{"name":"firebase_storage","path":"C:\\\\Users\\\\AshwaniKumar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\firebase_storage-12.0.1\\\\","native_build":true,"dependencies":["firebase_core"]},{"name":"path_provider_foundation","path":"C:\\\\Users\\\\AshwaniKumar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\AshwaniKumar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\sqflite-2.3.3+1\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\AshwaniKumar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"firebase_core","path":"C:\\\\Users\\\\AshwaniKumar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\firebase_core-3.1.0\\\\","native_build":true,"dependencies":[]},{"name":"firebase_storage","path":"C:\\\\Users\\\\AshwaniKumar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\firebase_storage-12.0.1\\\\","native_build":true,"dependencies":["firebase_core"]},{"name":"path_provider_windows","path":"C:\\\\Users\\\\AshwaniKumar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.2.1\\\\","native_build":false,"dependencies":[]}],"web":[{"name":"firebase_core_web","path":"C:\\\\Users\\\\AshwaniKumar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\firebase_core_web-2.17.2\\\\","dependencies":[]},{"name":"firebase_storage_web","path":"C:\\\\Users\\\\AshwaniKumar\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\firebase_storage_web-3.9.9\\\\","dependencies":["firebase_core_web"]}]},"dependencyGraph":[{"name":"firebase_core","dependencies":["firebase_core_web"]},{"name":"firebase_core_web","dependencies":[]},{"name":"firebase_storage","dependencies":["firebase_core","firebase_storage_web"]},{"name":"firebase_storage_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"sqflite","dependencies":[]}],"date_created":"2024-06-20 09:35:42.514963","version":"3.22.0"} \ No newline at end of file diff --git a/example/main.dart b/example/main.dart index af7cedc..9befd48 100644 --- a/example/main.dart +++ b/example/main.dart @@ -29,10 +29,10 @@ class MyHomePage extends StatefulWidget { final String title; @override - _MyHomePageState createState() => _MyHomePageState(); + MyHomePageState createState() => MyHomePageState(); } -class _MyHomePageState extends State { +class MyHomePageState extends State { @override void initState() { super.initState(); diff --git a/lib/src/cache_manager.dart b/lib/src/cache_manager.dart index 0a7f73f..267ea02 100644 --- a/lib/src/cache_manager.dart +++ b/lib/src/cache_manager.dart @@ -150,7 +150,7 @@ class FirebaseImageCacheManager { Future putFile( FirebaseImageObject object, final bytes) async { - String path = basePath + "/" + object.remotePath; + String path = "$basePath/${object.remotePath}"; path = path.replaceAll("//", "/"); //print(join(basePath, object.remotePath)); Join isn't working? final localFile = await File(path).create(recursive: true); diff --git a/lib/src/firebase_image.dart b/lib/src/firebase_image.dart index 2b1813a..fecc27d 100644 --- a/lib/src/firebase_image.dart +++ b/lib/src/firebase_image.dart @@ -1,4 +1,3 @@ -import 'dart:typed_data'; import 'dart:ui'; import 'package:firebase_core/firebase_core.dart'; @@ -28,7 +27,7 @@ class FirebaseImage extends ImageProvider { /// The model for the image object final FirebaseImageObject _imageObject; - /// Fetches, saves and returns an ImageProvider for any image in a readable Firebase Cloud Storeage bucket. + /// Fetches, saves and returns an ImageProvider for any image in a readable Firebase Cloud Storage bucket. /// /// [location] The URI of the image, in the bucket, to be displayed /// [shouldCache] Default: True. Specified whether or not an image should be cached (optional) @@ -40,7 +39,7 @@ class FirebaseImage extends ImageProvider { String location, { this.shouldCache = true, this.scale = 1.0, - this.maxSizeBytes = 2500 * 1000, // 2.5MB + this.maxSizeBytes = 2560 * 1024, // 2.5MB this.cacheRefreshStrategy = CacheRefreshStrategy.BY_METADATA_DATE, this.firebaseApp, }) : _imageObject = FirebaseImageObject( @@ -105,8 +104,8 @@ class FirebaseImage extends ImageProvider { } Future _fetchImageCodec() async { - return await PaintingBinding.instance! - .instantiateImageCodec(await _fetchImage()); + return await PaintingBinding.instance.instantiateImageCodecWithSize( + await ImmutableBuffer.fromUint8List(await _fetchImage())); } @override @@ -115,7 +114,8 @@ class FirebaseImage extends ImageProvider { } @override - ImageStreamCompleter load(FirebaseImage key, DecoderCallback decode) { + ImageStreamCompleter loadImage( + FirebaseImage key, ImageDecoderCallback decode) { return MultiFrameImageStreamCompleter( codec: key._fetchImageCodec(), scale: key.scale, @@ -123,15 +123,15 @@ class FirebaseImage extends ImageProvider { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { if (other.runtimeType != runtimeType) return false; - final FirebaseImage typedOther = other; + final FirebaseImage typedOther = other as FirebaseImage; return _imageObject.uri == typedOther._imageObject.uri && scale == typedOther.scale; } @override - int get hashCode => hashValues(_imageObject.uri, scale); + int get hashCode => Object.hash(_imageObject.uri, scale); @override String toString() => '$runtimeType("${_imageObject.uri}", scale: $scale)'; diff --git a/pubspec.yaml b/pubspec.yaml index bf525b0..3199be0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,22 +1,21 @@ name: firebase_image description: A cached Flutter ImageProvider for Firebase Cloud Storage image objects. -version: 1.1.1 -homepage: https://github.com/mattreid1/firebase_image +version: 1.1.2 +homepage: https://github.com/ash80/firebase_image environment: - sdk: ">=2.12.0 <3.0.0" + sdk: ">=2.17.0 <4.0.0" dependencies: flutter: sdk: flutter - firebase_core: ^1.7.0 - firebase_storage: ^10.0.5 - sqflite: ^2.0.0+4 - path: ^1.8.0 - path_provider: ^2.0.5 + firebase_core: ^3.1.0 + firebase_storage: ^12.0.1 + sqflite: ^2.3.3+1 + path: ^1.9.0 + path_provider: ^2.1.3 dev_dependencies: - flutter_lints: ^1.0.4 flutter_test: sdk: flutter