of<T> method

T of<T>(
  1. BuildContext context
)

Reactively discovers and observes an ancestor BloomProvider<T> within context.

Connects BloomBuildContextProviderExtension.bloomOf with this BloomVia tracking scope in a single, fluent call, eliminating nested via(context.bloomOf<T>()) boilerplate.

  • context: The active BuildContext to locate the ancestor provider from.

Exact Type Resolution:

  • Lookup matches the exact reified type T. Subtypes or base classes do not match.

Requires:

Ensures:

  • Subscribes this reactive tracking scope to the ancestor Bloom<T> node.
  • Returns the underlying value of type T.

Examples

@override
Widget build(BuildContext context, BloomVia via) {
  final store = via.of<ShowcaseStore>(context);
  return Text(store.title);
}

Implementation

@pragma('vm:prefer-inline')
T of<T>(BuildContext context) => this(context.bloomOf<T>());