toImage method
Returns the actual BlurHash image with the given width
and height
.
The width
and height
must not be null and greater than 0. It is
recommended to keep the width
and height
small and let the UI layer
handle upscaling for better performance.
Implementation
Image toImage(int width, int height) {
assert(width > 0);
assert(height > 0);
final data = _transform(width, height, components);
return Image.fromBytes(
width: width,
height: height,
bytes: data.buffer,
numChannels: 4,
);
}