From 5de4b2bc2e80eb7a0c12172bf5be6746f23570e3 Mon Sep 17 00:00:00 2001 From: Jon Mountjoy Date: Thu, 4 Mar 2021 21:25:17 +0000 Subject: [PATCH] null safety --- README.md | 6 +- example/flutter_app/ios/Podfile | 2 +- example/flutter_app/ios/Podfile.lock | 88 ++++++++++++++ .../ios/Runner.xcodeproj/project.pbxproj | 68 +++++++++++ .../contents.xcworkspacedata | 2 +- .../contents.xcworkspacedata | 3 + example/flutter_app/lib/main.dart | 2 +- example/flutter_app/pubspec.lock | 112 ++++++++++-------- example/flutter_app/pubspec.yaml | 4 +- lib/vb_image_cache.dart | 11 +- lib/vb_resource.dart | 31 +++-- pubspec.lock | 110 +++++++++-------- pubspec.yaml | 10 +- 13 files changed, 317 insertions(+), 132 deletions(-) create mode 100644 example/flutter_app/ios/Podfile.lock diff --git a/README.md b/README.md index 3d3ac38..e3b545f 100644 --- a/README.md +++ b/README.md @@ -32,16 +32,16 @@ VBCacheImage can be used with any widget that support an ImageProvider. ``` dart Image( fit: BoxFit.cover, - image: CacheImage('https://paste-your-link-here.com/image.png'), + image: VBCacheImage('https://paste-your-link-here.com/image.png'), ), Image( fit: BoxFit.cover, - image: CacheImage('https://paste-your-link-here.com/image.png', duration: Duration(seconds: 2), durationExpiration: Duration(seconds: 10)), + image: VBCacheImage('https://paste-your-link-here.com/image.png', duration: Duration(seconds: 2), durationExpiration: Duration(seconds: 10)), ), FadeInImage( fit: BoxFit.cover, placeholder: AssetImage('assets/placeholder.png'), - image: CacheImage('https://paste-your-link-here.com/image.png') + image: VBCacheImage('https://paste-your-link-here.com/image.png') ) ``` diff --git a/example/flutter_app/ios/Podfile b/example/flutter_app/ios/Podfile index 1e8c3c9..2c068c4 100644 --- a/example/flutter_app/ios/Podfile +++ b/example/flutter_app/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '9.0' +platform :ios, '12.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/example/flutter_app/ios/Podfile.lock b/example/flutter_app/ios/Podfile.lock new file mode 100644 index 0000000..9289d47 --- /dev/null +++ b/example/flutter_app/ios/Podfile.lock @@ -0,0 +1,88 @@ +PODS: + - Firebase/CoreOnly (7.3.0): + - FirebaseCore (= 7.3.0) + - Firebase/Storage (7.3.0): + - Firebase/CoreOnly + - FirebaseStorage (~> 7.3.0) + - firebase_core (1.0.0): + - Firebase/CoreOnly (= 7.3.0) + - Flutter + - firebase_storage (8.0.0): + - Firebase/Storage (= 7.3.0) + - firebase_core + - Flutter + - FirebaseCore (7.3.0): + - FirebaseCoreDiagnostics (~> 7.0) + - GoogleUtilities/Environment (~> 7.0) + - GoogleUtilities/Logger (~> 7.0) + - FirebaseCoreDiagnostics (7.5.0): + - GoogleDataTransport (~> 8.0) + - GoogleUtilities/Environment (~> 7.0) + - GoogleUtilities/Logger (~> 7.0) + - nanopb (~> 2.30907.0) + - FirebaseStorage (7.3.0): + - FirebaseCore (~> 7.0) + - GTMSessionFetcher/Core (~> 1.4) + - Flutter (1.0.0) + - GoogleDataTransport (8.2.0): + - nanopb (~> 2.30907.0) + - GoogleUtilities/Environment (7.2.0): + - PromisesObjC (~> 1.2) + - GoogleUtilities/Logger (7.2.0): + - GoogleUtilities/Environment + - GTMSessionFetcher/Core (1.5.0) + - nanopb (2.30907.0): + - nanopb/decode (= 2.30907.0) + - nanopb/encode (= 2.30907.0) + - nanopb/decode (2.30907.0) + - nanopb/encode (2.30907.0) + - path_provider (0.0.1): + - Flutter + - PromisesObjC (1.2.12) + +DEPENDENCIES: + - firebase_core (from `.symlinks/plugins/firebase_core/ios`) + - firebase_storage (from `.symlinks/plugins/firebase_storage/ios`) + - Flutter (from `Flutter`) + - path_provider (from `.symlinks/plugins/path_provider/ios`) + +SPEC REPOS: + trunk: + - Firebase + - FirebaseCore + - FirebaseCoreDiagnostics + - FirebaseStorage + - GoogleDataTransport + - GoogleUtilities + - GTMSessionFetcher + - nanopb + - PromisesObjC + +EXTERNAL SOURCES: + firebase_core: + :path: ".symlinks/plugins/firebase_core/ios" + firebase_storage: + :path: ".symlinks/plugins/firebase_storage/ios" + Flutter: + :path: Flutter + path_provider: + :path: ".symlinks/plugins/path_provider/ios" + +SPEC CHECKSUMS: + Firebase: 26223c695fe322633274198cb19dca8cb7e54416 + firebase_core: f47224dd6a9b928b4cf0128b0d004ec9e47d4bf2 + firebase_storage: a4b292db6551a64c3697c7e67cb1df524b494bb1 + FirebaseCore: 4d3c72622ce0e2106aaa07bb4b2935ba2c370972 + FirebaseCoreDiagnostics: 35685db68b11fe7d19d2d8b557fd7e3a56ac81cc + FirebaseStorage: 5002b1895bfe74a5ce92ad54f966e6162d0da2e5 + Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c + GoogleDataTransport: 1024b1a4dfbd7a0e92cb20d7e0a6f1fb66b449a4 + GoogleUtilities: d866834472f1324d080496bc67ab3ce5d0d46027 + GTMSessionFetcher: b3503b20a988c4e20cc189aa798fd18220133f52 + nanopb: 59221d7f958fb711001e6a449489542d92ae113e + path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c + PromisesObjC: 3113f7f76903778cf4a0586bd1ab89329a0b7b97 + +PODFILE CHECKSUM: 4e8f8b2be68aeea4c0d5beb6ff1e79fface1d048 + +COCOAPODS: 1.10.0 diff --git a/example/flutter_app/ios/Runner.xcodeproj/project.pbxproj b/example/flutter_app/ios/Runner.xcodeproj/project.pbxproj index 926b44e..e473373 100644 --- a/example/flutter_app/ios/Runner.xcodeproj/project.pbxproj +++ b/example/flutter_app/ios/Runner.xcodeproj/project.pbxproj @@ -9,6 +9,7 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 5D192E04CEE2721D573C4348 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2C0AB8CF038803494F8E729F /* Pods_Runner.framework */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; @@ -31,7 +32,9 @@ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 2C0AB8CF038803494F8E729F /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 6B9B82227C951EFB400BC7EE /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; @@ -42,6 +45,8 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + E29E5173C2990BFDAE1C4250 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + E58E8C1C5E1AD1D605D371FF /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -49,12 +54,24 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 5D192E04CEE2721D573C4348 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 666CE504CF0318B9EE837CA8 /* Pods */ = { + isa = PBXGroup; + children = ( + E58E8C1C5E1AD1D605D371FF /* Pods-Runner.debug.xcconfig */, + 6B9B82227C951EFB400BC7EE /* Pods-Runner.release.xcconfig */, + E29E5173C2990BFDAE1C4250 /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -72,6 +89,8 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, + 666CE504CF0318B9EE837CA8 /* Pods */, + AAB4B6F68EAFD8133CD2C714 /* Frameworks */, ); sourceTree = ""; }; @@ -98,6 +117,14 @@ path = Runner; sourceTree = ""; }; + AAB4B6F68EAFD8133CD2C714 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 2C0AB8CF038803494F8E729F /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -105,12 +132,14 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + 7ABB639FDC0C2A12424509A8 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + E41FB903B88A17A65A5B865A /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -183,6 +212,28 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; + 7ABB639FDC0C2A12424509A8 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -197,6 +248,23 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + E41FB903B88A17A65A5B865A /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/example/flutter_app/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/example/flutter_app/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 1d526a1..919434a 100644 --- a/example/flutter_app/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/example/flutter_app/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/example/flutter_app/ios/Runner.xcworkspace/contents.xcworkspacedata b/example/flutter_app/ios/Runner.xcworkspace/contents.xcworkspacedata index 1d526a1..21a3cc1 100644 --- a/example/flutter_app/ios/Runner.xcworkspace/contents.xcworkspacedata +++ b/example/flutter_app/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + diff --git a/example/flutter_app/lib/main.dart b/example/flutter_app/lib/main.dart index 6dee469..5ad680f 100644 --- a/example/flutter_app/lib/main.dart +++ b/example/flutter_app/lib/main.dart @@ -32,7 +32,7 @@ class MyApp extends StatelessWidget { } class MyHomePage extends StatefulWidget { - MyHomePage({Key key, this.title}) : super(key: key); + MyHomePage({Key? key, required this.title}) : super(key: key); // This widget is the home page of your application. It is stateful, meaning // that it has a State object (defined below) that contains fields that affect diff --git a/example/flutter_app/pubspec.lock b/example/flutter_app/pubspec.lock index e8fe1b2..9b2d646 100644 --- a/example/flutter_app/pubspec.lock +++ b/example/flutter_app/pubspec.lock @@ -7,42 +7,42 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.2" + version: "2.5.0" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.3" + version: "1.2.0" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.13" + version: "1.15.0" cupertino_icons: dependency: "direct main" description: @@ -56,56 +56,63 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" ffi: dependency: transitive description: name: ffi url: "https://pub.dartlang.org" source: hosted - version: "0.1.3" + version: "1.0.0" file: dependency: transitive description: name: file url: "https://pub.dartlang.org" source: hosted - version: "5.2.1" + version: "6.1.0" firebase_core: dependency: transitive description: name: firebase_core url: "https://pub.dartlang.org" source: hosted - version: "0.5.2" + version: "1.0.0" firebase_core_platform_interface: dependency: transitive description: name: firebase_core_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "4.0.0" firebase_core_web: dependency: transitive description: name: firebase_core_web url: "https://pub.dartlang.org" source: hosted - version: "0.2.1" + version: "1.0.0" firebase_storage: dependency: transitive description: name: firebase_storage url: "https://pub.dartlang.org" source: hosted - version: "5.0.1" + version: "8.0.0" firebase_storage_platform_interface: dependency: transitive description: name: firebase_storage_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "2.0.0" + firebase_storage_web: + dependency: transitive + description: + name: firebase_storage_web + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" flutter: dependency: "direct main" description: flutter @@ -121,104 +128,111 @@ packages: description: flutter source: sdk version: "0.0.0" - intl: + http: + dependency: transitive + description: + name: http + url: "https://pub.dartlang.org" + source: hosted + version: "0.13.0" + http_parser: dependency: transitive description: - name: intl + name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "0.16.1" + version: "4.0.0" js: dependency: transitive description: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.2" + version: "0.6.3" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.8" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.8" + version: "1.3.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" path_provider: dependency: "direct main" description: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "1.6.24" + version: "2.0.1" path_provider_linux: dependency: transitive description: name: path_provider_linux url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+2" + version: "2.0.0" path_provider_macos: dependency: transitive description: name: path_provider_macos url: "https://pub.dartlang.org" source: hosted - version: "0.0.4+6" + version: "2.0.0" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "2.0.1" path_provider_windows: dependency: transitive description: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "0.0.4+3" + version: "2.0.0" + pedantic: + dependency: transitive + description: + name: pedantic + url: "https://pub.dartlang.org" + source: hosted + version: "1.11.0" platform: dependency: transitive description: name: platform url: "https://pub.dartlang.org" source: hosted - version: "2.2.1" + version: "3.0.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "2.0.0" process: dependency: transitive description: name: process url: "https://pub.dartlang.org" source: hosted - version: "3.0.13" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.5" + version: "4.1.0" sky_engine: dependency: transitive description: flutter @@ -230,77 +244,77 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.5" + 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.17" + version: "0.2.19" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0" vb_image_cache: dependency: "direct main" description: path: "../.." relative: true source: path - version: "1.0.0" + version: "2.0.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.0" win32: dependency: transitive description: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "1.7.3" + version: "2.0.0" xdg_directories: dependency: transitive description: name: xdg_directories url: "https://pub.dartlang.org" source: hosted - version: "0.1.0" + version: "0.2.0" sdks: - dart: ">=2.9.0-14.0.dev <3.0.0" - flutter: ">=1.17.0 <2.0.0" + dart: ">=2.12.0 <3.0.0" + flutter: ">=1.20.0" diff --git a/example/flutter_app/pubspec.yaml b/example/flutter_app/pubspec.yaml index a80ca3e..1cdd415 100644 --- a/example/flutter_app/pubspec.yaml +++ b/example/flutter_app/pubspec.yaml @@ -18,13 +18,13 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: ">=2.7.0 <3.0.0" + sdk: '>=2.12.0 <3.0.0' dependencies: flutter: sdk: flutter - path_provider: ^1.6.24 + path_provider: ^2.0.1 vb_image_cache: path: ../../ diff --git a/lib/vb_image_cache.dart b/lib/vb_image_cache.dart index 7b99cd1..940e9f5 100644 --- a/lib/vb_image_cache.dart +++ b/lib/vb_image_cache.dart @@ -24,8 +24,7 @@ class VBCacheImage extends ImageProvider { this.duration = const Duration(seconds: 1), this.durationMultiplier = 1.5, this.durationExpiration = const Duration(seconds: 10), - }) : assert(url != null), - _resource = VBResource(url, duration, durationMultiplier, durationExpiration); + }) : _resource = VBResource(url, duration, durationMultiplier, durationExpiration); /// The scale to place in the [ImageInfo] object of the image. final double scale; @@ -45,7 +44,7 @@ class VBCacheImage extends ImageProvider { VBResource _resource; Future _fetchImage() async { - Uint8List file; + Uint8List? file; await _resource.init(); final bool check = await _resource.checkFile(); if (check) { @@ -53,10 +52,10 @@ class VBCacheImage extends ImageProvider { } else { file = await _resource.storeFile(); } - if (file.length > 0) { - return PaintingBinding.instance.instantiateImageCodec(file); + if (file!.length > 0) { + return PaintingBinding.instance!.instantiateImageCodec(file); } - return null; + throw Exception("Zero length file encountered"); } @override diff --git a/lib/vb_resource.dart b/lib/vb_resource.dart index e6342a3..b4af27c 100644 --- a/lib/vb_resource.dart +++ b/lib/vb_resource.dart @@ -20,18 +20,17 @@ class VBResource { final double durationMultiplier; final Duration durationExpiration; - Uri _temp; - Uri _local; - Uri _remote; + Uri? _temp; + Uri? _local; + Uri? _remote; Duration _retry; VBResource(this.uri, this.duration, this.durationMultiplier, this.durationExpiration) - : assert(uri != null), - _retry = duration; + : _retry = duration; - Uri get remote => _remote; - Uri get temp => _temp; - Uri get local => _local; + Uri? get remote => _remote; + Uri? get temp => _temp; + Uri? get local => _local; Uri _parse(String uri) { return Uri.parse(uri); @@ -45,21 +44,21 @@ class VBResource { Future init() async { _temp = await _getTempDir(); _remote = _parse(uri); - _local = _parse(_temp.path + '/' + _remote.hashCode.toString()); + _local = _parse(_temp!.path + '/' + _remote.hashCode.toString()); return this; } Future checkFile() async { - final File file = File(_local.path); + final File file = File(_local!.path); if (file.existsSync() && file.lengthSync() > 0) { return true; } return false; } - Future getFile() async { - final File file = File(_local.path); + Future getFile() async { + final File file = File(_local!.path); if (file.existsSync() && file.lengthSync() > 0) { return file.readAsBytesSync(); } @@ -67,10 +66,10 @@ class VBResource { } Future storeFile() async { - File file = await File(_local.path).create(recursive: true); + File file = await File(_local!.path).create(recursive: true); // Check FireStorage scheme - if (_remote.scheme == 'gs') { - final Reference ref = FirebaseStorage.instance.ref().child(_remote.path); + if (_remote!.scheme == 'gs') { + final Reference ref = FirebaseStorage.instance.ref().child(_remote!.path); final dynamic url = await ref.getDownloadURL(); _remote = Uri.parse(url); } @@ -79,7 +78,7 @@ class VBResource { await Future.delayed(_retry).then((_) async { try { HttpClient httpClient = new HttpClient(); - final HttpClientRequest request = await httpClient.getUrl(_remote); + final HttpClientRequest request = await httpClient.getUrl(_remote!); final HttpClientResponse response = await request.close(); final Uint8List bytes = await consolidateHttpClientResponseBytes(response, autoUncompress: false); diff --git a/pubspec.lock b/pubspec.lock index 32058aa..d422922 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,98 +7,105 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.2" + version: "2.5.0" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.3" + version: "1.2.0" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.13" + version: "1.15.0" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" ffi: dependency: transitive description: name: ffi url: "https://pub.dartlang.org" source: hosted - version: "0.1.3" + version: "1.0.0" file: dependency: transitive description: name: file url: "https://pub.dartlang.org" source: hosted - version: "5.2.1" + version: "6.1.0" firebase_core: dependency: transitive description: name: firebase_core url: "https://pub.dartlang.org" source: hosted - version: "0.5.2" + version: "1.0.0" firebase_core_platform_interface: dependency: transitive description: name: firebase_core_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "4.0.0" firebase_core_web: dependency: transitive description: name: firebase_core_web url: "https://pub.dartlang.org" source: hosted - version: "0.2.1" + version: "1.0.0" firebase_storage: dependency: "direct main" description: name: firebase_storage url: "https://pub.dartlang.org" source: hosted - version: "5.0.1" + version: "8.0.0" firebase_storage_platform_interface: dependency: transitive description: name: firebase_storage_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "2.0.0" + firebase_storage_web: + dependency: transitive + description: + name: firebase_storage_web + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" flutter: dependency: "direct main" description: flutter @@ -114,104 +121,111 @@ packages: description: flutter source: sdk version: "0.0.0" - intl: + http: dependency: transitive description: - name: intl + name: http url: "https://pub.dartlang.org" source: hosted - version: "0.16.1" + version: "0.13.0" + http_parser: + dependency: transitive + description: + name: http_parser + url: "https://pub.dartlang.org" + source: hosted + version: "4.0.0" js: dependency: transitive description: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.2" + version: "0.6.3" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.8" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.8" + version: "1.3.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" path_provider: dependency: "direct main" description: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "1.6.24" + version: "2.0.1" path_provider_linux: dependency: transitive description: name: path_provider_linux url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+2" + version: "2.0.0" path_provider_macos: dependency: transitive description: name: path_provider_macos url: "https://pub.dartlang.org" source: hosted - version: "0.0.4+6" + version: "2.0.0" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "2.0.1" path_provider_windows: dependency: transitive description: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "0.0.4+3" + version: "2.0.0" + pedantic: + dependency: transitive + description: + name: pedantic + url: "https://pub.dartlang.org" + source: hosted + version: "1.11.0" platform: dependency: transitive description: name: platform url: "https://pub.dartlang.org" source: hosted - version: "2.2.1" + version: "3.0.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "2.0.0" process: dependency: transitive description: name: process url: "https://pub.dartlang.org" source: hosted - version: "3.0.13" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.5" + version: "4.1.0" sky_engine: dependency: transitive description: flutter @@ -223,70 +237,70 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.5" + 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.17" + version: "0.2.19" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.0" win32: dependency: transitive description: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "1.7.3" + version: "2.0.0" xdg_directories: dependency: transitive description: name: xdg_directories url: "https://pub.dartlang.org" source: hosted - version: "0.1.0" + version: "0.2.0" sdks: - dart: ">=2.9.0-14.0.dev <3.0.0" - flutter: ">=1.17.0 <2.0.0" + dart: ">=2.12.0 <3.0.0" + flutter: ">=1.20.0" diff --git a/pubspec.yaml b/pubspec.yaml index 7c417a4..dc612ba 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,20 +1,20 @@ name: vb_image_cache description: A new Flutter package for caching images -version: 1.0.0 +version: 2.0.0 author: Vaibhav Bhasin homepage: https://github.com/Root-vb/VBCacheImage environment: - sdk: ">=2.7.0 <3.0.0" - flutter: ">=1.17.0 <2.0.0" + sdk: '>=2.12.0 <3.0.0' + flutter: ">=1.17.0" dependencies: flutter: sdk: flutter - firebase_storage: ^5.0.1 - path_provider: ^1.6.24 + firebase_storage: ^8.0.0 + path_provider: ^2.0.1 dev_dependencies: flutter_test: