createCanvasView method

Future createCanvasView(
  1. dynamic onViewCreated(
    1. int viewID
    ),
  2. {dynamic key}
)

Create a canvas view.

When you need to render local preview video through startPreview, or render remote playing stream's video through startPlayingStream, you need to call this function to create a canvas view first.

This function will create a canvas view (actully a PlatformView or a ExternalTexture in native (or web) side), and return a corresponding flutter widget which can be added into the flutter render tree.

You should also listen to the onViewCreated callback, which will be called back when the canvas view has been created, then you can use the viewID to create a ZegoCanvas object for video rendering.

Implementation

Future<Widget?> createCanvasView(Function(int viewID) onViewCreated,
    {Key? key}) async {
  return await ZegoExpressCanvasViewImpl.createCanvasView(onViewCreated,
      key: key);
}