getImage method

Future<Image?> getImage(
  1. String imageName
)

Implementation

Future<Image?> getImage(String imageName) async {
  if (imagesPaths == null) {
    return null;
  }

  /// The file name is like this: "IMG-20220609-WA0012.jpg (file attached)"
  imageName = imageName.split(' ').first;
  String? path = imagesPaths
      ?.firstWhereOrNull((String path) => path.contains(imageName));
  if (path == null) {
    return null;
  }
  return await getImageByPath(path);
}