loadImage method
Implementation
Widget loadImage({required double size, Color? color}) {
// if (contains('http')) {
// return CachedNetworkImage(
// imageUrl: this,
// width: width,
// height: height,
// color: color,
// errorWidget: (context, url, error) => Icon(Icons.error),
// );
// }
if (contains('.svg')) {
final img = SvgPicture.asset(
this,
width: size,
height: size,
color: color,
);
return img;
}
if (contains('.png')) {
return Image.asset(
this,
width: size,
height: size,
color: color,
);
}
throw 'Assest $this failed to load';
}