Element class abstract

A node in the widget tree, analogous to Flutter's Element.

Elements represent the instantiation of a Widget at a particular location in the tree. They manage the lifecycle and state of their associated widget.

Implementers

Constructors

Element(Widget widget)
Creates an Element for the given widget.

Properties

dirty bool
Whether this element has been marked as needing to be rebuilt.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
parent Element?
The parent of this element in the tree, or null if this is the root.
no setter
renderObject RenderObject?
The RenderObject associated with this element, if any.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
widget Widget
The current configuration of this element.
getter/setter pair

Methods

dependOnInheritedWidgetOfExactType<T extends InheritedWidget>() → T?
Obtains the nearest InheritedWidget of type T and registers this element as a dependent so it rebuilds when the inherited widget changes.
findAncestorElementOfExactType<T extends InheritedWidget>() InheritedElement?
Returns the nearest InheritedElement of type T.
findAncestorWidgetOfExactType<T extends Widget>() → T?
Returns the nearest ancestor widget of the given type T.
markNeedsBuild() → void
Marks this element as needing to be rebuilt in the next frame.
mount(Element? parent) → void
Adds this element to the tree at the given parent.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
unmount() → void
Removes this element from the tree and releases resources.
update(Widget newWidget) → void
Updates the widget configuration to newWidget.
updateChild(Element? child, Widget newWidget) Element?
Updates the given child to use the given newWidget, returning the updated or newly created child element.
visitChildren(void visitor(Element e)) → void
Calls visitor for each direct child of this element.

Operators

operator ==(Object other) bool
The equality operator.
inherited