loadImageDynamic function

Widget loadImageDynamic(
  1. String imageUrl, {
  2. BoxFit fit = BoxFit.cover,
  3. double? width,
  4. double? height,
  5. Widget? placeHolder,
  6. Widget? errorWidget,
})

Load dynamic image or url or svg

Implementation

Widget loadImageDynamic(String imageUrl, {BoxFit fit = BoxFit.cover, double? width, double? height, Widget? placeHolder, Widget? errorWidget}){
  return NUIFutureWidget<String?>(
    futureValue: imageUrlContentType(imageUrl),
    callback: (state, data, message){
      if(data!= null && data.contains("svg")){
        return SizedBox(width: width, height: height, child: SvgPicture.network(imageUrl));
      }
      return loadImage(
        imageUrl,
        width: width,
        height: height,
        fit: fit,
      );
    },
  );
}