previewTexture property

void previewTexture=(NativeTexture texture)

Sets the NativeTexture to be used for live preview.

This method must be called before startPreview.

The one exception is that if the preview native texture is not set (or set to null) before startPreview is called, then this method may be called once with a non-null parameter to set the preview texture. (This allows camera setup and surface creation to happen in parallel, saving time.) The preview native texture may not otherwise change while preview is running.

Implementation

set previewTexture(NativeTexture texture) {
  assert(!_isClosed);

  CameraChannel.channel.invokeMethod<void>(
    'Camera#previewTexture',
    <String, dynamic>{'handle': handle, 'nativeTexture': texture.asMap()},
  );
}