XContextPylon extension
Extension on BuildContext offering utility methods to access, query, modify, and observe Pylon and MutablePylon widgets in the widget tree.
- on
Methods
-
hasPylon<
T> ({Type? runtime}) → bool -
Available on BuildContext, provided by the XContextPylon extension
Checks if a Pylon widget of typeT(or matchingruntimetype) is available in the ancestor chain of this context. -
modPylon<
T> (T modifier(T)) → void -
Available on BuildContext, provided by the XContextPylon extension
Applies amodifierfunction to the current value of the nearest ancestor MutablePylon of typeTin this context, updating it with the result. -
pylon<
T> ({Type? runtime}) → T -
Available on BuildContext, provided by the XContextPylon extension
Retrieves the value from the nearest ancestor Pylon widget of typeTin this context, throwing an error if none found; optionally filters byruntimetype. -
pylonOr<
T> ({Type? runtime}) → T? -
Available on BuildContext, provided by the XContextPylon extension
Retrieves the value from the nearest ancestor Pylon widget of typeTin this context, or null if none found; optionally filters byruntimetype. -
setPylon<
T> (T value) → void -
Available on BuildContext, provided by the XContextPylon extension
Updates the value of the nearest ancestor MutablePylon of typeTin this context with the providedvalue, throwing an error if no mutable Pylon of typeTexists. -
streamPylon<
T> () → Stream< T> -
Available on BuildContext, provided by the XContextPylon extension
Returns the reactive Stream from the nearest ancestor MutablePylon of typeTin this context for observing value changes. -
watchPylon<
T> (Widget builder(T data)) → Widget -
Available on BuildContext, provided by the XContextPylon extension
Builds a widget that watches the Stream from the nearest MutablePylon of typeTusing a StreamBuilder, rendering via the providedbuilderfunction with initial data from the current Pylon value or a shrunk widget if no data available.