How to get `Uint8List` from `ImmutableBuffer`?

Viewed 98

The new Flutter 3.3 deprecates the method load of class ImageProvider and now some my code became not working because load had a parameter bytes of type Uit8List but loadBuffer has a parameter buffer of ImmutableBuffer.

I used Uint8List to decode image using image package

final bytes = img.decodeImage(bytes); // bytes is instance of Uit8List

The complete code can be read from the article Remove a color from an image in Flutter starting from section 4. Decode.

enter image description here

And now I need to convert ImmutableBuffer to Uint8List. Does someone know how to do this?

0 Answers
Related