From ab478da265e7e0b1bd16a4e59c16f141c0a1b789 Mon Sep 17 00:00:00 2001 From: Matt Reid Date: Fri, 12 Mar 2021 13:17:04 +0000 Subject: [PATCH] Added pre-cache function. --- lib/src/firebase_image.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/src/firebase_image.dart b/lib/src/firebase_image.dart index 4062d10..f7735d2 100644 --- a/lib/src/firebase_image.dart +++ b/lib/src/firebase_image.dart @@ -54,6 +54,12 @@ class FirebaseImage extends ImageProvider { return _fetchImage(); } + /// Pre-caches an image + Future preCache() async { + if (shouldCache == false) throw "Caching must be enabled to pre-cache an image."; + await _fetchImage(); + } + static String _getBucket(String location) { final uri = Uri.parse(location); return '${uri.scheme}://${uri.authority}';