BuildContext class abstract

A handle to the location of a widget in the widget tree.

Implementers

Constructors

BuildContext()

Properties

appTargetId String
App's target id.
no setter
hashCode int
The hash code for this object.
no setterinherited
key Key?
Associated widget's key.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
widget Widget
The configuration for this render element.
no setter
widgetRuntimeType String
Widget's runtime type.
no setter

Methods

dependOnInheritedWidgetOfExactType<T extends InheritedWidget>() → 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.
findAncestorRenderElementOfExactType<T extends RenderElement>() → T?
Returns the nearest ancestor render element of the given type T, which must be the type of a concrete RenderElement subclass.
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.
findClosestDomNode() Element
Returns dom node that's associated with the current context.
findClosestDomNodeInAncestors() Element?
Returns the nearest dom node in ancestors.
findClosestDomNodeInDescendants() Element?
Returns the nearest dom node in descendants.
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.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setMetaInformation({required String informationId, required MetaInformation information}) → void
Add or update document meta information.
toString() String
A string representation of this object.
inherited
traverseAncestorElements(RenderElementCallback callback) → void
Traverse the ancestor elements.
traverseChildElements(RenderElementCallback callback) → void
Traverse the child elements of this render element.
unsetMetaInformation({required String informationId}) → void
Clear meta information associated with meta information id.
visitAncestorElements(RenderElementVisitor visitor) → 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.
visitChildElements(RenderElementVisitor visitor) → void
Walks the children of this render element. The callback is given a reference to the child widget's corresponding Element object. The walk stops when it reaches the end of child or when the callback returns false.

Operators

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