buildPreview method

  1. @override
Widget buildPreview(
  1. int textureId
)
override

Builds the widget that renders the preview started with startPreview.

On the desktop and mobile implementations this is a zero-copy Texture fed by the native frame producer. The web implementation overrides this to return an HtmlElementView hosting the getUserMedia stream.

Implementation

@override
Widget buildPreview(int textureId) {
  final viewType = _viewTypes[textureId];
  if (viewType == null) {
    return const SizedBox.shrink();
  }
  return HtmlElementView(viewType: viewType);
}