TextureLayer class

A composited layer that maps a backend texture to a rectangle.

Backend textures are images that can be applied (mapped) to an area of the Flutter view. They are created, managed, and updated using a platform-specific texture registry. This is typically done by a plugin that integrates with host platform video player, camera, or OpenGL APIs, or similar image sources.

A texture layer refers to its backend texture using an integer ID. Texture IDs are obtained from the texture registry and are scoped to the Flutter view. Texture IDs may be reused after deregistration, at the discretion of the registry. The use of texture IDs currently unknown to the registry will silently result in a blank rectangle.

Once inserted into the layer tree, texture layers are repainted autonomously as dictated by the backend (e.g. on arrival of a video frame). Such repainting generally does not involve executing Dart code.

Texture layers are always leaves in the layer tree.

See also:



TextureLayer({@required Rect rect, @required int textureId, bool freeze: false, FilterQuality filterQuality: ui.FilterQuality.low})
Creates a texture layer bounded by rect and with backend texture identified by textureId, if freeze is true new texture frames will not be populated to the texture, and use filterQuality to set layer's FilterQuality.


alwaysNeedsAddToScene bool
Subclasses may override this to true to disable retained rendering.
@protected, read-only, inherited
attached bool
Whether this node is in a tree whose root is attached to something. [...]
read-only, inherited
debugCreator ↔ dynamic
The object responsible for creating this layer. [...]
read / write, inherited
debugSubtreeNeedsAddToScene bool
Whether this or any descendant layer in the subtree needs addToScene. [...]
@visibleForTesting, read-only, inherited
depth int
The depth of this node in the tree. [...]
read-only, inherited
engineLayer EngineLayer
Stores the engine layer created for this layer in order to reuse engine resources across frames for better app performance. [...]
@protected, read / write, inherited
filterQuality FilterQuality
The quality of sampling the texture and rendering it on screen. [...]
freeze bool
When true the texture that will not be updated with new frames. [...]
hashCode int
The hash code for this object. [...]
read-only, inherited
nextSibling Layer
This layer's next sibling in the parent layer's child list.
read-only, inherited
owner Object
The owner for this node (null if unattached). [...]
read-only, inherited
parent ContainerLayer
This layer's parent in the layer tree. [...]
read-only, inherited
previousSibling Layer
This layer's previous sibling in the parent layer's child list.
read-only, inherited
rect Rect
Bounding rectangle of this layer.
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
textureId int
The identity of the backend texture.


addToScene(SceneBuilder builder, [Offset layerOffset = Offset.zero]) → void
Override this method to upload this layer to the engine. [...]
adoptChild(covariant AbstractNode child) → void
Mark the given node as being a child of this node. [...]
attach(covariant Object owner) → void
Mark this node as attached to the given owner. [...]
@mustCallSuper, inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children. [...]
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
debugMarkClean() → void
Mark that this layer is in sync with engine. [...]
@visibleForTesting, inherited
detach() → void
Mark this node as detached. [...]
@mustCallSuper, inherited
dropChild(covariant AbstractNode child) → void
Disconnect the given node from this node. [...]
find<S>(Offset localPosition) → S
Search this layer and its subtree for the first annotation of type S under the point described by localPosition. [...]
findAll<S>(Offset localPosition) Iterable<S>
Search this layer and its subtree for all annotations of type S under the point described by localPosition. [...]
@Deprecated('Use findAllAnnotations(...).annotations instead. ' 'This feature was deprecated after v1.10.14.'), inherited
findAllAnnotations<S>(Offset localPosition) AnnotationResult<S>
Search this layer and its subtree for all annotations of type S under the point described by localPosition. [...]
findAnnotations<S>(AnnotationResult<S> result, Offset localPosition, {bool onlyFirst}) bool
Search this layer and its subtree for annotations of type S at the location described by localPosition. [...]
@protected, override
markNeedsAddToScene() → void
Mark that this layer has changed and addToScene needs to be called.
@protected, @visibleForTesting, inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
redepthChild(AbstractNode child) → void
Adjust the depth of the given child to be greater than this node's own depth. [...]
@protected, inherited
redepthChildren() → void
Adjust the depth of this node's children, if any. [...]
remove() → void
Removes this layer from its parent layer's child list. [...]
@mustCallSuper, inherited
toDiagnosticsNode({String name, DiagnosticsTreeStyle style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep. [...]
toString({DiagnosticLevel minLevel: DiagnosticLevel.info}) String
Returns a string representation of this object.
toStringDeep({String prefixLineOne: '', String prefixOtherLines, DiagnosticLevel minLevel: DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants. [...]
toStringShallow({String joiner: ', ', DiagnosticLevel minLevel: DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object. [...]
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode. [...]
updateSubtreeNeedsAddToScene() → void
Traverses the layer subtree starting from this layer and determines whether it needs addToScene. [...]
@protected, @visibleForTesting, inherited


operator ==(Object other) bool
The equality operator. [...]