toIcon method

Widget? toIcon(
  1. String? code, {
  2. double? size,
  3. String? color,
})

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));
  }
}