BuildContext class abstract interface

Where a widget sits in the tree, as its build and its state see it.

Implementers
Available extensions

Properties

hashCode → int
The hash code for this object.
no setterinherited
mounted → bool
Whether the element is still mounted: false once it was unmounted.
no setter
owner → BuildOwner?
The owner that builds the tree.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
widget → Widget
The widget the element currently shows.
no setter

Methods

dependOnInheritedElement(InheritedElement ancestor) → InheritedWidget
Depends on ancestor, the element of an inherited widget above this context, as dependOnInheritedWidgetOfExactType does, and returns its widget.
dependOnInheritedWidgetOfExactType<T extends InheritedWidget>() → T?
The nearest InheritedWidget of exactly the type T above this context (or the context's own widget), found in constant time; null if there is none.
findAncestorStateOfType<T extends State<StatefulWidget>>() → T?
The state of the nearest stateful ancestor whose state is a T.
findAncestorWidgetOfExactType<T extends Widget>() → T?
The widget of the nearest ancestor whose widget is exactly a T.
findRenderObject() → RenderObject?
The render object of the element, or of the nearest element below it that has one.
getElementForInheritedWidgetOfExactType<T extends InheritedWidget>() → InheritedElement?
The element of the widget dependOnInheritedWidgetOfExactType finds, without depending on it.
getInheritedWidgetOfExactType<T extends InheritedWidget>() → T?
The widget dependOnInheritedWidgetOfExactType finds, without depending on it.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read<T>() → T

Available on BuildContext, provided by the ReadContext extension

The T of the nearest provider of one above this context, without depending on it: for callbacks, as context.read<Counter>().increment() on a key, and for State.initState. A ProviderNotFoundException if there is none, unless T is nullable: then null.
select<T, R>(R selector(T value)) → R

Available on BuildContext, provided by the SelectContext extension

What selector picks from the T of the nearest provider of one above this context, which is rebuilt only when a change of the value makes selector pick something else: not ==, lists, sets, maps and other iterables compared element by element. A build may select any number of parts, of one value or of several; each build selects anew. A ProviderNotFoundException if there is none, unless T is nullable.
toString() → String
A string representation of this object.
inherited
visitAncestorElements(ConditionalElementVisitor visitor) → void
Calls visitor for each ancestor, nearest first, until it returns false.
watch<T>() → T

Available on BuildContext, provided by the WatchContext extension

The T of the nearest provider of one above this context, which is rebuilt each time it changes, as long as its builds watch it. A ProviderNotFoundException if there is none, unless T is nullable: then null.

Operators

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