imageByUrl function

Image imageByUrl(
  1. String imageUrl, {
  2. double? width,
  3. double? height,
  4. AlignmentGeometry alignment = Alignment.center,
})

Implementation

Image imageByUrl(String imageUrl, {double? width, double? height, AlignmentGeometry alignment = Alignment.center}) {
  if (isImageBase64(imageUrl)) {
    return Image.memory(base64.decode(imageUrl), width: width, height: height, alignment: alignment);
  }

  if (imageUrl.startsWith('http')) {
    return Image.network(imageUrl, width: width, height: height, alignment: alignment);
  }
  return Image.file(io.File(imageUrl), width: width, height: height, alignment: alignment);
}