Skip to content

Commit 97fb1e2

Browse files
authored
Merge pull request #33 from mattreid1/precache-dev
Added pre-cache function
2 parents 08a7c0a + ab478da commit 97fb1e2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/src/firebase_image.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ class FirebaseImage extends ImageProvider<FirebaseImage> {
5454
return _fetchImage();
5555
}
5656

57+
/// Pre-caches an image
58+
Future<void> preCache() async {
59+
if (shouldCache == false) throw "Caching must be enabled to pre-cache an image.";
60+
await _fetchImage();
61+
}
62+
5763
static String _getBucket(String location) {
5864
final uri = Uri.parse(location);
5965
return '${uri.scheme}://${uri.authority}';

0 commit comments

Comments
 (0)