Skip to content

Commit

Permalink
Added pre-cache function.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattreid1 committed Mar 12, 2021
1 parent fc90937 commit ab478da
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/src/firebase_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ class FirebaseImage extends ImageProvider<FirebaseImage> {
return _fetchImage();
}

/// Pre-caches an image
Future<void> 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}';
Expand Down

0 comments on commit ab478da

Please sign in to comment.