asImage method

Image asImage(
  1. {double? width,
  2. double? height,
  3. ColorDescriptor? color,
  4. Key? key}
)

Implementation

Image asImage({
  double? width,
  double? height,
  ColorDescriptor? color,
  Key? key,
}) {
  if (data != null) {
    String base64String = data!.split('base64,').last;
    return Image.memory(
      base64Decode(base64String),
      key: key,
      width: width,
      height: height,
      color: color?.color,
    );
  }
  return Image.asset(
    location,
    key: key,
    width: width,
    height: height,
    color: color?.color,
    package: packageName,
  );
}