attachPreviewTexture method

Future<int> attachPreviewTexture()

Attach preview frames to a Flutter Texture.

Returns the id to passed a Texture.

If the Camera is already using a texture, the same id will be returned. call releasePreviewTexture to detach and release the current texture.

Throws a PlatformException if stopping preview fails; usually this would be because of a hardware or other low-level error, or because release has been called on this Camera instance.

Implementation

Future<int> attachPreviewTexture() async {
  return _currentTexture ??=
      await _channel.$attachPreviewTexture(this) as int;
}