diff --git a/android/local.properties b/android/local.properties index b669130..6383cd0 100644 --- a/android/local.properties +++ b/android/local.properties @@ -1,3 +1,3 @@ -sdk.dir=/Users/alessiopracchia/Library/Android/sdk -flutter.sdk=/Users/alessiopracchia/Work/flutter +sdk.dir=/media/Archivos/SoftWare/SDK/android +flutter.sdk=/home/lex/snap/flutter/common/flutter flutter.versionName=0.0.2 \ No newline at end of file diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index b0d600d..8321ffb 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 28 + compileSdkVersion 31 sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -40,7 +40,7 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.oxequa.cacheimage.example" minSdkVersion 16 - targetSdkVersion 28 + targetSdkVersion 31 versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 6089bd5..2577bb4 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -6,10 +6,11 @@ additional functionality it is fine to subclass or reimplement FlutterApplication and put your custom class here. --> + diff --git a/example/android/build.gradle b/example/android/build.gradle index 3100ad2..e2ddae5 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.3.50' + ext.kotlin_version = '1.4.30' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' + classpath 'com.android.tools.build:gradle:4.1.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index 296b146..bc6a58a 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip diff --git a/example/lib/main.dart b/example/lib/main.dart index 313c900..3e9cd02 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,10 +1,25 @@ +import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter/cupertino.dart'; import 'package:cache_image/cache_image.dart'; import 'package:path_provider/path_provider.dart'; -void main() => runApp(MyApp()); +void main() async { + + WidgetsFlutterBinding.ensureInitialized(); + await Firebase.initializeApp( + options: FirebaseOptions( + apiKey: '', + appId: '', + messagingSenderId: '', + projectId: '', + authDomain: "", + storageBucket: "", + ) + ); + runApp(MyApp()); +} class MyApp extends StatelessWidget { // This widget is the root of your application. @@ -90,7 +105,7 @@ class _MyHomePageState extends State { child: FadeInImage( fit: BoxFit.cover, placeholder: AssetImage('assets/placeholder.png'), - image: CacheImage('gs://testing-9ea12.appspot.com/bake-1706051_1920.jpg') + image: CacheImage('gs://q-tumin.appspot.com/companies/tumin/tumin_90x90.png') ), ), Positioned( diff --git a/example/pubspec.lock b/example/pubspec.lock index a2586e9..97db77a 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -1,69 +1,55 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - archive: - dependency: transitive - description: - name: archive - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.11" - args: - dependency: transitive - description: - name: args - url: "https://pub.dartlang.org" - source: hosted - version: "1.5.2" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.0" + version: "2.8.2" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "2.1.0" cache_image: dependency: "direct main" description: path: ".." relative: true source: path - version: "1.0.4" - charcode: + version: "1.0.7" + characters: dependency: transitive description: - name: charcode + name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" - collection: + version: "1.2.0" + charcode: dependency: transitive description: - name: collection + name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" - convert: + version: "1.3.1" + clock: dependency: transitive description: - name: convert + name: clock url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" - crypto: + version: "1.1.0" + collection: dependency: transitive description: - name: crypto + name: collection url: "https://pub.dartlang.org" source: hosted - version: "2.1.3" + version: "1.16.0" cupertino_icons: dependency: "direct main" description: @@ -71,41 +57,69 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.3" - firebase: + fake_async: dependency: transitive description: - name: firebase + name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "7.1.0" - firebase_core: + version: "1.3.0" + ffi: + dependency: transitive + description: + name: ffi + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.1" + file: dependency: transitive + description: + name: file + url: "https://pub.dartlang.org" + source: hosted + version: "6.1.2" + firebase_core: + dependency: "direct main" description: name: firebase_core url: "https://pub.dartlang.org" source: hosted - version: "0.4.3+1" + version: "1.17.0" firebase_core_platform_interface: dependency: transitive description: name: firebase_core_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.2" + version: "4.4.0" firebase_core_web: dependency: transitive description: name: firebase_core_web url: "https://pub.dartlang.org" source: hosted - version: "0.1.1+1" + version: "1.6.4" firebase_storage: - dependency: transitive + dependency: "direct main" description: name: firebase_storage url: "https://pub.dartlang.org" source: hosted - version: "3.1.0" + version: "10.2.16" + firebase_storage_platform_interface: + dependency: transitive + description: + name: firebase_storage_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "4.1.6" + firebase_storage_web: + dependency: transitive + description: + name: firebase_storage_web + url: "https://pub.dartlang.org" + source: hosted + version: "3.2.15" flutter: dependency: "direct main" description: flutter @@ -127,84 +141,119 @@ packages: name: http url: "https://pub.dartlang.org" source: hosted - version: "0.12.0+2" + version: "0.13.4" http_parser: dependency: transitive description: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "3.1.3" - image: - dependency: transitive - description: - name: image - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.4" + version: "4.0.1" js: dependency: transitive description: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.1+1" + version: "0.6.4" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.6" + version: "0.12.11" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.4" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.8" + version: "1.7.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.4" + version: "1.8.1" path_provider: dependency: transitive description: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "1.5.1" - pedantic: + version: "2.0.10" + path_provider_android: dependency: transitive description: - name: pedantic + name: path_provider_android url: "https://pub.dartlang.org" source: hosted - version: "1.8.0+1" - petitparser: + version: "2.0.14" + path_provider_ios: dependency: transitive description: - name: petitparser + name: path_provider_ios url: "https://pub.dartlang.org" source: hosted - version: "2.4.0" + version: "2.0.9" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.6" + path_provider_macos: + dependency: transitive + description: + name: path_provider_macos + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.6" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.4" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.6" platform: dependency: transitive description: name: platform url: "https://pub.dartlang.org" source: hosted - version: "2.2.1" - quiver: + version: "3.1.0" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.2" + process: dependency: transitive description: - name: quiver + name: process url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "4.2.4" sky_engine: dependency: transitive description: flutter @@ -216,63 +265,70 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.8.2" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.11" + version: "0.4.9" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.1" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" - xml: + version: "2.1.2" + win32: + dependency: transitive + description: + name: win32 + url: "https://pub.dartlang.org" + source: hosted + version: "2.6.1" + xdg_directories: dependency: transitive description: - name: xml + name: xdg_directories url: "https://pub.dartlang.org" source: hosted - version: "3.5.0" + version: "0.2.0+1" sdks: - dart: ">=2.4.0 <3.0.0" - flutter: ">=1.12.13+hotfix.5 <2.0.0" + dart: ">=2.17.0 <3.0.0" + flutter: ">=2.8.1" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index f6787cb..0cb02cd 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -26,6 +26,10 @@ dependencies: cache_image: path: ../ + + firebase_core: ^1.17.0 + firebase_storage: ^10.2.16 + dev_dependencies: flutter_test: sdk: flutter diff --git a/lib/resource.dart b/lib/resource.dart index ebf5cfb..3d4dc46 100644 --- a/lib/resource.dart +++ b/lib/resource.dart @@ -2,9 +2,9 @@ library cache_image; import 'dart:io'; import 'dart:typed_data'; -import 'package:firebase_storage/firebase_storage.dart'; import 'package:flutter/foundation.dart'; import 'package:path_provider/path_provider.dart'; +import 'package:firebase_storage/firebase_storage.dart' as firebase_storage; class Resource { final String uri; @@ -62,8 +62,7 @@ class Resource { File file = await File(_local.path).create(recursive: true); // Check FireStorage scheme if (_remote.scheme == 'gs') { - final StorageReference ref = - FirebaseStorage.instance.ref().child(_remote.path); + firebase_storage.Reference ref = firebase_storage.FirebaseStorage.instance.ref().child(_remote.path); final dynamic url = await ref.getDownloadURL(); _remote = Uri.parse(url); } diff --git a/pubspec.lock b/pubspec.lock index c6a65df..0010c42 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,97 +1,111 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - archive: + async: dependency: transitive description: - name: archive + name: async url: "https://pub.dartlang.org" source: hosted - version: "2.0.11" - args: + version: "2.8.2" + boolean_selector: dependency: transitive description: - name: args + name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.5.2" - async: + version: "2.1.0" + characters: dependency: transitive description: - name: async + name: characters url: "https://pub.dartlang.org" source: hosted - version: "2.4.0" - boolean_selector: + version: "1.2.0" + charcode: dependency: transitive description: - name: boolean_selector + name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" - charcode: + version: "1.3.1" + clock: dependency: transitive description: - name: charcode + name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" - convert: + version: "1.16.0" + fake_async: dependency: transitive description: - name: convert + name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" - crypto: + version: "1.3.0" + ffi: dependency: transitive description: - name: crypto + name: ffi url: "https://pub.dartlang.org" source: hosted - version: "2.1.3" - firebase: + version: "1.2.1" + file: dependency: transitive description: - name: firebase + name: file url: "https://pub.dartlang.org" source: hosted - version: "7.1.0" + version: "6.1.2" firebase_core: dependency: transitive description: name: firebase_core url: "https://pub.dartlang.org" source: hosted - version: "0.4.3+1" + version: "1.17.0" firebase_core_platform_interface: dependency: transitive description: name: firebase_core_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.2" + version: "4.4.0" firebase_core_web: dependency: transitive description: name: firebase_core_web url: "https://pub.dartlang.org" source: hosted - version: "0.1.1+1" + version: "1.6.4" firebase_storage: dependency: "direct main" description: name: firebase_storage url: "https://pub.dartlang.org" source: hosted - version: "3.1.0" + version: "10.2.16" + firebase_storage_platform_interface: + dependency: transitive + description: + name: firebase_storage_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "4.1.6" + firebase_storage_web: + dependency: transitive + description: + name: firebase_storage_web + url: "https://pub.dartlang.org" + source: hosted + version: "3.2.15" flutter: dependency: "direct main" description: flutter @@ -113,84 +127,119 @@ packages: name: http url: "https://pub.dartlang.org" source: hosted - version: "0.12.0+2" + version: "0.13.4" http_parser: dependency: transitive description: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "3.1.3" - image: - dependency: transitive - description: - name: image - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.4" + version: "4.0.1" js: dependency: transitive description: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.1+1" + version: "0.6.4" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.6" + version: "0.12.11" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.4" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.8" + version: "1.7.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.4" + version: "1.8.1" path_provider: dependency: "direct main" description: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "1.5.1" - pedantic: + version: "2.0.10" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.14" + path_provider_ios: dependency: transitive description: - name: pedantic + name: path_provider_ios url: "https://pub.dartlang.org" source: hosted - version: "1.8.0+1" - petitparser: + version: "2.0.9" + path_provider_linux: dependency: transitive description: - name: petitparser + name: path_provider_linux url: "https://pub.dartlang.org" source: hosted - version: "2.4.0" + version: "2.1.6" + path_provider_macos: + dependency: transitive + description: + name: path_provider_macos + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.6" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.4" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.6" platform: dependency: transitive description: name: platform url: "https://pub.dartlang.org" source: hosted - version: "2.2.1" - quiver: + version: "3.1.0" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.2" + process: dependency: transitive description: - name: quiver + name: process url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "4.2.4" sky_engine: dependency: transitive description: flutter @@ -202,63 +251,70 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.8.2" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.11" + version: "0.4.9" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.1" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" - xml: + version: "2.1.2" + win32: + dependency: transitive + description: + name: win32 + url: "https://pub.dartlang.org" + source: hosted + version: "2.6.1" + xdg_directories: dependency: transitive description: - name: xml + name: xdg_directories url: "https://pub.dartlang.org" source: hosted - version: "3.5.0" + version: "0.2.0+1" sdks: - dart: ">=2.4.0 <3.0.0" - flutter: ">=1.12.13+hotfix.4 <2.0.0" + dart: ">=2.17.0 <3.0.0" + flutter: ">=2.8.1" diff --git a/pubspec.yaml b/pubspec.yaml index 51e48fd..7158f5a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,18 +1,17 @@ name: cache_image description: Flutter plugin to load and cache network or firebase storage images with a retry mechanism if the download fails. -version: 1.0.5 +version: 1.0.8 homepage: https://github.com/oxequa/flutter_cache_image environment: - sdk: ">=2.1.0 <3.0.0" - flutter: ">=1.12.13 <2.0.0" + sdk: ">=2.7.0 <3.0.0" dependencies: flutter: sdk: flutter - firebase_storage: ^3.1.0 - path_provider: ^1.5.1 + firebase_storage: ^10.2.16 + path_provider: ^2.0.10 dev_dependencies: flutter_test: