AbstractCache.best constructor Null safety

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

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

Implementation

factory AbstractCache.best({
  final String? iconUrl,
  final double? width,
  final double? height,
  final 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);
}