InheritedElement class Null safety

An Element that uses an InheritedWidget as its configuration.



InheritedElement(InheritedWidget widget)
Creates an element that uses the given widget as its configuration.


debugDoingBuild bool
Whether the widget is currently updating the widget or render tree. [...]
read-only, inherited
debugIsDefunct bool
Returns true if the Element is defunct. [...]
read-only, inherited
depth int
An integer that is guaranteed to be greater than the parent's, if any. The element at the root of the tree must have a depth greater than 0.
read-only, inherited
dirty bool
Returns true if the element has been marked as needing rebuilding.
read-only, inherited
hashCode int
The hash code for this object. [...]
read-only, inherited
owner BuildOwner?
The object that manages the lifecycle of this element.
read-only, inherited
renderObject RenderObject?
The render object at (or below) this location in the tree. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
size Size?
The size of the RenderBox returned by findRenderObject. [...]
read-only, inherited
slot Object?
Information set by parent to define where this child fits in its parent's child list. [...]
read-only, inherited
widget Widget
The configuration for this element. [...]
read-only, inherited


activate() → void
Transition from the "inactive" to the "active" lifecycle state. [...]
@mustCallSuper, inherited
attachNotificationTree() → void
Called in Element.mount and Element.activate to register this element in the notification tree. [...]
@protected, inherited
attachRenderObject(Object? newSlot) → void
Add renderObject to the render tree at the location specified by newSlot. [...]
build() Widget
Subclasses should override this function to actually call the appropriate build function (e.g., or for their widget.
deactivate() → void
Transition from the "active" to the "inactive" lifecycle state. [...]
@mustCallSuper, inherited
deactivateChild(Element child) → void
Move the given element to the list of inactive elements and detach its render object from the render tree. [...]
@protected, inherited
debugDeactivated() → void
Called, in debug mode, after children have been deactivated (see deactivate). [...]
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. [...]
debugGetCreatorChain(int limit) String
Returns a description of what caused this element to be created. [...]
debugGetDiagnosticChain() List<Element>
Returns the parent chain from this element back to the root of the tree. [...]
debugVisitOnstageChildren(ElementVisitor visitor) → void
Calls the argument for each child considered onstage. [...]
dependOnInheritedElement(InheritedElement ancestor, {Object? aspect}) InheritedWidget
Registers this build context with ancestor such that when ancestor's widget changes this build context is rebuilt. [...]
dependOnInheritedWidgetOfExactType<T extends InheritedWidget>({Object? aspect}) → T?
Obtains the nearest widget of the given type T, which must be the type of a concrete InheritedWidget subclass, and registers this build context with that widget such that when that widget changes (or a new widget of that type is introduced, or the widget goes away), this build context is rebuilt so that it can obtain new values from that widget. [...]
describeElement(String name, {DiagnosticsTreeStyle style = DiagnosticsTreeStyle.errorProperty}) DiagnosticsNode
Returns a description of the Element associated with the current build context. [...]
describeMissingAncestor({required Type expectedAncestorType}) List<DiagnosticsNode>
Adds a description of a specific type of widget missing from the current build context's ancestry tree. [...]
describeOwnershipChain(String name) DiagnosticsNode
Adds a description of the ownership chain from a specific Element to the error report. [...]
describeWidget(String name, {DiagnosticsTreeStyle style = DiagnosticsTreeStyle.errorProperty}) DiagnosticsNode
Returns a description of the Widget associated with the current build context. [...]
detachRenderObject() → void
Remove renderObject from the render tree. [...]
didChangeDependencies() → void
Called when a dependency of this element changes. [...]
@mustCallSuper, inherited
dispatchNotification(Notification notification) → void
Start bubbling this notification at the given build context. [...]
findAncestorRenderObjectOfType<T extends RenderObject>() → T?
Returns the RenderObject object of the nearest ancestor RenderObjectWidget widget that is an instance of the given type T. [...]
findAncestorStateOfType<T extends State<StatefulWidget>>() → T?
Returns the State object of the nearest ancestor StatefulWidget widget that is an instance of the given type T. [...]
findAncestorWidgetOfExactType<T extends Widget>() → T?
Returns the nearest ancestor widget of the given type T, which must be the type of a concrete Widget subclass. [...]
findRenderObject() RenderObject?
The current RenderObject for the widget. If the widget is a RenderObjectWidget, this is the render object that the widget created for itself. Otherwise, it is the render object of the first descendant RenderObjectWidget. [...]
findRootAncestorStateOfType<T extends State<StatefulWidget>>() → T?
Returns the State object of the furthest ancestor StatefulWidget widget that is an instance of the given type T. [...]
forgetChild(Element child) → void
Remove the given child from the element's child list, in preparation for the child being reused elsewhere in the element tree. [...]
getDependencies(Element dependent) Object?
Returns the dependencies value recorded for dependent with setDependencies. [...]
getElementForInheritedWidgetOfExactType<T extends InheritedWidget>() InheritedElement?
Obtains the element corresponding to the nearest widget of the given type T, which must be the type of a concrete InheritedWidget subclass. [...]
inflateWidget(Widget newWidget, Object? newSlot) Element
Create an element for the given widget and add it as a child of this element in the given slot. [...]
@protected, inherited
markNeedsBuild() → void
Marks the element as dirty and adds it to the global list of widgets to rebuild in the next frame. [...]
mount(Element? parent, Object? newSlot) → void
Add this element to the tree in the given slot of the given parent. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
notifyClients(covariant InheritedWidget oldWidget) → void
Notifies all dependent elements that this inherited widget has changed, by calling Element.didChangeDependencies. [...]
notifyDependent(covariant InheritedWidget oldWidget, Element dependent) → void
Called by notifyClients for each dependent. [...]
performRebuild() → void
Calls the method of the StatelessWidget object (for stateless widgets) or the method of the State object (for stateful widgets) and then updates the widget tree. [...]
reassemble() → void
Called whenever the application is reassembled during debugging, for example during hot reload. [...]
@mustCallSuper, @protected, inherited
rebuild() → void
Cause the widget to update itself. In debug builds, also verify various invariants. [...]
setDependencies(Element dependent, Object? value) → void
Sets the value returned by getDependencies value for dependent. [...]
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 =}) String
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 short, textual description of this element.
unmount() → void
Transition from the "inactive" to the "defunct" lifecycle state. [...]
@mustCallSuper, inherited
update(covariant ProxyWidget newWidget) → void
Change the widget used to configure this element. [...]
updateChild(Element? child, Widget? newWidget, Object? newSlot) Element?
Update the given child with the given new configuration. [...]
@protected, inherited
updated(covariant InheritedWidget oldWidget) → void
Calls Element.didChangeDependencies of all dependent elements, if InheritedWidget.updateShouldNotify returns true. [...]
updateDependencies(Element dependent, Object? aspect) → void
Called by dependOnInheritedWidgetOfExactType when a new dependent is added. [...]
updateSlotForChild(Element child, Object? newSlot) → void
Change the slot that the given child occupies in its parent. [...]
@protected, inherited
visitAncestorElements(bool visitor(Element element)) → void
Walks the ancestor chain, starting with the parent of this build context's widget, invoking the argument for each ancestor. The callback is given a reference to the ancestor widget's corresponding Element object. The walk stops when it reaches the root widget or when the callback returns false. The callback must not return null. [...]
visitChildElements(ElementVisitor visitor) → void
Wrapper around visitChildren for BuildContext.
visitChildren(ElementVisitor visitor) → void
Calls the argument for each child. Must be overridden by subclasses that support having children. [...]


operator ==(Object other) bool
Compare two widgets for equality. [...]
@nonVirtual, inherited