fromBytes method
Creates texture from raw RGBA bytes.
Implementation
Future<void> fromBytes(Uint8List rgba, int width, int height) async {
final completer = ui.ImmutableBuffer.fromUint8List(rgba);
final buffer = await completer;
final descriptor = ui.ImageDescriptor.raw(
buffer,
width: width,
height: height,
pixelFormat: ui.PixelFormat.rgba8888,
);
final codec = await descriptor.instantiateCodec();
final frame = await codec.getNextFrame();
_image = frame.image;
_width = width;
_height = height;
_loaded = true;
}