toIcon method
Implementation
Widget? toIcon(String? code, {double? size, String? color}) {
if (code?.startsWith("http://") == true ||
code?.startsWith("https://") == true) {
return CachedNetworkImage(
imageUrl: code!,
width: size,
height: size,
errorWidget: (context, url, error) => const Icon(Icons.error));
} else {
return code == null
? null
: Icon(toIconData(code), size: size, color: toColor(color));
}
}