Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgraded libraries and fixed code issues #65

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -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"}
4 changes: 2 additions & 2 deletions example/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ class MyHomePage extends StatefulWidget {
final String title;

@override
_MyHomePageState createState() => _MyHomePageState();
MyHomePageState createState() => MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
class MyHomePageState extends State<MyHomePage> {
@override
void initState() {
super.initState();
Expand Down
2 changes: 1 addition & 1 deletion lib/src/cache_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class FirebaseImageCacheManager {

Future<FirebaseImageObject> 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);
Expand Down
18 changes: 9 additions & 9 deletions lib/src/firebase_image.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'dart:typed_data';
import 'dart:ui';

import 'package:firebase_core/firebase_core.dart';
Expand Down Expand Up @@ -28,7 +27,7 @@ class FirebaseImage extends ImageProvider<FirebaseImage> {
/// 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)
Expand All @@ -40,7 +39,7 @@ class FirebaseImage extends ImageProvider<FirebaseImage> {
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(
Expand Down Expand Up @@ -105,8 +104,8 @@ class FirebaseImage extends ImageProvider<FirebaseImage> {
}

Future<Codec> _fetchImageCodec() async {
return await PaintingBinding.instance!
.instantiateImageCodec(await _fetchImage());
return await PaintingBinding.instance.instantiateImageCodecWithSize(
await ImmutableBuffer.fromUint8List(await _fetchImage()));
}

@override
Expand All @@ -115,23 +114,24 @@ class FirebaseImage extends ImageProvider<FirebaseImage> {
}

@override
ImageStreamCompleter load(FirebaseImage key, DecoderCallback decode) {
ImageStreamCompleter loadImage(
FirebaseImage key, ImageDecoderCallback decode) {
return MultiFrameImageStreamCompleter(
codec: key._fetchImageCodec(),
scale: key.scale,
);
}

@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)';
Expand Down
17 changes: 8 additions & 9 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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