startFlip method
Implementation
Future<void> startFlip() async {
RenderObject? boundary = _renderKey.currentContext?.findRenderObject();
if (boundary is RenderRepaintBoundary) {
await _queueAction(() async {
var image = await boundary.toImage(
pixelRatio: MediaQuery.of(context).devicePixelRatio,
);
var buffer = await image.toByteData(format: ImageByteFormat.rawRgba);
if (buffer != null) {
var bytes = buffer.buffer
.asUint8List(buffer.offsetInBytes, buffer.lengthInBytes);
if (!_disposed) {
controller.beginDraw();
_render.updateTexture(image.width, image.height, bytes);
_render.draw(1, 1);
controller.endDraw();
_flipping.value = true;
}
}
});
}
}