maybeOf<T> static method
Retrieves the nearest SolidProvider of type T from the widget tree. Returns null if no provider is found.
Implementation
static T? maybeOf<T>(BuildContext context, {bool listen = true}) {
if (listen) {
return context
.dependOnInheritedWidgetOfExactType<InheritedSolidProvider<T>>()
?.data;
}
final provider = context
.getElementForInheritedWidgetOfExactType<InheritedSolidProvider<T>>()
?.widget;
return (provider as InheritedSolidProvider<T>?)?.data;
}