AbstractCache.best constructor

AbstractCache.best({
  1. String? iconUrl,
  2. double? width,
  3. double? height,
  4. Color? color,
})

Returns the best cache possibility: none, svg or png/jpeg

Implementation

factory AbstractCache.best({
  String? iconUrl,
  double? width,
  double? height,
  Color? color,
}) {
  if (iconUrl == null) {
    return NullCache(width: width, height: height);
  }
  if (iconUrl.endsWith('.svg')) {
    return SvgCache(iconUrl, color: color, width: width, height: height);
  }
  return RasterCache(iconUrl, width: width, height: height);
}