Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Glide equivalent in flutter

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.

like image 352
Febin K R Avatar asked Jul 20 '20 11:07

Febin K R


People also ask

Is Picasso better than Glide?

Glide's loading times are faster and it uses a small amount of memory for cache, but the library size is quite large. It, too, is easy to implement. Glide might be a better alternative to Picasso when memory footprint is less of a concern or more and larger images need to be processed.

Which is faster glide or Picasso?

Glide is faster and the results of Picasso and Coil are similar. But what about when we are loading from the cache. As you can see in the images below we have the best times for Glide in most of the cases. Coil is the second and Picasso is the last one by far.

What is cached network image in Flutter?

Cached network image A flutter library to show images from the internet and keep them in the cache directory.

What are the best alternatives to flutter?

The below comparison tables give you an overview of the best available alternatives for Flutter. The first table consists of a comparison between Flutter, React Native, Xamarin, and ionic: Higher. Flutter 60 fps or 120 fps animation. Flutter itself paints and controls every single pixel on the screen. High.

What is flutter and how does it work?

Flutter is a user interface software development kit for developing android, ios, web and desktop applications from a single codebase. This is how I define flutter.

How to teach flutter layout to beginners?

Instead, first tell them that Flutter layout is very different from HTML layout (which is probably where they’re coming from), and then make them memorize the following rule: Constraints go down. Sizes go up. Parent sets position. Flutter layout can’t really be understood without knowing this rule, so Flutter developers should learn it early on.

What is lazy loader in flutter?

Flutter – Lazy Loader Last Updated : 28 Oct, 2020 The Lazy loader is a wrapper to the ScrollView that enables lazy loading. It is very useful in situations where the application’s intent is to show endless content in a ListView.


Video Answer


2 Answers

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.

like image 139
Michel Feinstein Avatar answered Oct 20 '22 00:10

Michel Feinstein


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.

like image 26
Gk Mohammad Emon Avatar answered Oct 19 '22 23:10

Gk Mohammad Emon