resizeIfNeeded method

ImageProvider resizeIfNeeded (
  1. int cacheWidth,
  2. int cacheHeight,
  3. ImageProvider provider
)

Composes the provider in a ResizeImage only when cacheWidth and cacheHeight are not both null.

When cacheWidth and cacheHeight are both null, this will return the provider directly.

Implementation

static ImageProvider<dynamic> resizeIfNeeded(int cacheWidth, int cacheHeight, ImageProvider<dynamic> provider) {
  if (cacheWidth != null || cacheHeight != null) {
    return ResizeImage(provider, width: cacheWidth, height: cacheHeight);
  }
  return provider;
}