Glide equivalent in flutter

3,069

Solution 1

cached_network_image is the equivalent of Glide or Picasso for Flutter.

It will use a default caching logic but if you want you can pass your own CacheManager to it. I am not sure why you need the checksum, but I assume is something related to cache management.

Solution 2

You can use it named Optimized Cached Image which is loading images from network, resizing, and caching them for memory sensitivity. This resizes and stores the images in the cache based on parent container constraints and hence loads images of lower size into memory. This is heavily inspired by the cached network image library.

This library exposes two classes for loading images

OptimizedCacheImage which is a 1:1 mapping of CachedNetworkImage.

OptimizedCacheImageProvider which is a mapping of CachedNetworkImageProvider.

Share:
3,069
Febin K R
Author by

Febin K R

Updated on December 22, 2022

Comments

  • Febin K R
    Febin K R over 1 year

    Im my SDK sample app in native android, an image is loaded using Glide library as follows.

    private void updateProfilePhoto(BadgeUIEntity badgeUIEntity) {
        String profilePhotoChecksum = badgeUIEntity.profilePhotoChecksum();
        String profilePhotoUrl = badgeUIEntity.profilePhotoUrl();
               if (profilePhotoChecksum != null && !TextUtils.isEmpty(profilePhotoUrl)) {
                try {
                    RequestOptions requestOptions = RequestOptions.signatureOf(new ObjectKey(profilePhotoChecksum));
                    Glide.with(this)
                            .applyDefaultRequestOptions(requestOptions)
                            .load(profilePhotoUrl).into(ivProfilePhoto);
                } catch (Exception e) {
                    Timber.v(e);
                }
            }}
    

    How can I render the same image in flutter? I have no idea what to do with this checksum in Flutter.