encodeWidget function

FutureOr<Uint8List> encodeWidget(
  1. Widget root
)

Encodes the given root widget into a BlobNode.

Implementation

FutureOr<Uint8List> encodeWidget(Widget root) async {
  final context = root.createRenderObject();
  final rootNode = await context.encode();

  print(rootNode);

  final library = RemoteWidgetLibrary([], [
    WidgetDeclaration('root', null, rootNode),
  ]);

  return encodeLibraryBlob(library);
}