imageFromPath function

Image imageFromPath(
  1. String path, {
  2. BoxFit? fit,
  3. double? width,
  4. double? height,
})

Implementation

Image imageFromPath(
  String path, {
  BoxFit? fit,
  double? width,
  double? height,
}) {
  if (isAssetPath(path)) {
    return Image.asset(
      path,
      fit: fit,
      width: width,
      height: height,
    );
  } else {
    return Image.file(
      File(path),
      fit: fit,
      width: width,
      height: height,
    );
  }
}