decodedCacheRatioCap property

double decodedCacheRatioCap

The maximum multiple of the compressed image size used when caching an animated image.

Individual frames of animated images can be cached into memory to avoid using CPU to re-decode them for every loop in the animation. This behavior will result in out-of-memory crashes when decoding large (or large numbers of) animated images so is disabled by default. Set this value to control how much memory each animated image is allowed to use for caching decoded frames compared to its compressed size. For example, setting this to 2.0 means that a 400KB GIF would be allowed at most to use 800KB of memory caching unessential decoded frames. A setting of 1.0 or less disables all caching of unessential decoded frames. See _kDefaultDecodedCacheRatioCap for the default value.

@deprecated The in-memory cache of decoded frames causes issues with memory consumption. Soon this API and the in-memory cache will be removed. See flutter/flutter#26081 for more context.

Implementation

@deprecated
double get decodedCacheRatioCap => _kDecodedCacheRatioCap;
void decodedCacheRatioCap= (double value)

Changes the maximum multiple of compressed image size used when caching an animated image.

Changing this value only affects new images, not images that have already been decoded.

@deprecated The in-memory cache of decoded frames causes issues with memory consumption. Soon this API and the in-memory cache will be removed. See flutter/flutter#26081 for more context.

Implementation

@deprecated
set decodedCacheRatioCap(double value) {
  assert (value != null);
  assert (value >= 0.0);
  _kDecodedCacheRatioCap = value;
}