There are several ways of retrieving ByteData from network image or file, however I haven't found one where an existing Image in memory (or cache) can be converted into ByteData.
Specifically referring to :
var resizedImage = ResizeImage(img.image, height: 28, width: 28);
For example, both the following answers assume there is a file:
How to load Image widgets from ByteData in Flutter
How to get a Flutter Uint8List from a Network Image?
There is a toByteData method from dart.ui, but that also requires the image to come from a raw data.
According to ResizeImage documentation, it's stored in cache, But I can't access it without using cache manager.
The cached image will be directly decoded and stored at the resolution defined by width and height. The image will lose detail and use less memory if resized to a size smaller than the native size.
I've used path_provider to get temporary directory, but it seems empty when resize image is executed. Is there anyway to convert image into ByteData without having the image in a path?