BuildContext class sealed
The BuildContext supplied to a Components build() method.
- Implementers
- Available extensions
Properties
- binding → AppBinding
-
The root component binding that manages the component tree.
no setter
- component → Component
-
The current configuration of the Element that is this BuildContext.
no setter
-
Available on BuildContext, provided by the AppContext extension
The cookies sent with the current request.no setter - debugDoingBuild → bool
-
Whether the component is currently updating the component or render tree.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
→ Map<
String, String> -
Available on BuildContext, provided by the AppContext extension
The HTTP headers of the current request with case-insensitive keys.no setter -
headersAll
→ Map<
String, List< String> > -
Available on BuildContext, provided by the AppContext extension
The HTTP headers of the current request with multiple values with case-insensitive keys.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- url → String
-
Available on BuildContext, provided by the AppContext extension
The currently active url.no setter - url → String
-
Available on BuildContext, provided by the AppContext extension
The url of the current request.no setter - url → String
-
Available on BuildContext, provided by the AppContext extension
The currently visited url.no setter
Methods
-
dependOnInheritedComponentOfExactType<
T extends InheritedComponent> ({Object? aspect}) → T? -
Obtains the nearest component of the given type
T
, which must be the type of a concrete InheritedComponent subclass, and registers this build context with that component such that when that component changes (or a new component of that type is introduced, or the component goes away), this build context is rebuilt so that it can obtain new values from that component. -
dependOnInheritedElement(
InheritedElement ancestor, {Object? aspect}) → InheritedComponent -
Registers this build context with
ancestor
such that whenancestor
's component changes this build context is rebuilt. -
dispatchNotification(
Notification notification) → void - Start bubbling this notification at the given build context.
-
findAncestorStateOfType<
T extends State< (StatefulComponent> >) → T? -
Returns the State object of the nearest ancestor StatefulComponent component
that is an instance of the given type
T
. -
getElementForInheritedComponentOfExactType<
T extends InheritedComponent> () → InheritedElement? -
Obtains the element corresponding to the nearest component of the given type
T
, which must be the type of a concrete InheritedComponent subclass. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setCookie(
String name, String value, {DateTime? expires, int? maxAge, String? domain, String? path, bool secure = false, bool httpOnly = true, SameSite? sameSite}) → void -
Available on BuildContext, provided by the AppContext extension
Sets the cookie with the given name and value in the response. -
setHeader(
String name, String value) → void -
Available on BuildContext, provided by the AppContext extension
Sets the response header with the given name and value. -
setStatusCode(
int statusCode, {String? responseBody}) → void -
Available on BuildContext, provided by the AppContext extension
Sets the response status code. -
toString(
) → String -
A string representation of this object.
inherited
-
visitAncestorElements(
bool visitor(Element element)) → void - Walks the ancestor chain, starting with the parent of this build context's component, invoking the argument for each ancestor. The callback is given a reference to the ancestor component's corresponding Element object. The walk stops when it reaches the root component or when the callback returns false. The callback must not return null.
-
visitChildElements(
ElementVisitor visitor) → void - Walks the children of this component.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited