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 type T (or matching runtime type) is available in the ancestor chain of this context.
modPylon<T>(T modifier(T)) → void

Available on BuildContext, provided by the XContextPylon extension

Applies a modifier function to the current value of the nearest ancestor MutablePylon of type T in 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 type T in this context, throwing an error if none found; optionally filters by runtime type.
pylonOr<T>({Type? runtime}) → T?

Available on BuildContext, provided by the XContextPylon extension

Retrieves the value from the nearest ancestor Pylon widget of type T in this context, or null if none found; optionally filters by runtime type.
setPylon<T>(T value) → void

Available on BuildContext, provided by the XContextPylon extension

Updates the value of the nearest ancestor MutablePylon of type T in this context with the provided value, throwing an error if no mutable Pylon of type T exists.
streamPylon<T>() Stream<T>

Available on BuildContext, provided by the XContextPylon extension

Returns the reactive Stream from the nearest ancestor MutablePylon of type T in 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 type T using a StreamBuilder, rendering via the provided builder function with initial data from the current Pylon value or a shrunk widget if no data available.