maybeFind<T> static method
Optionally find the data of the given type from the context.
TThe type of the data.contextThe build context.
Implementation
static T? maybeFind<T>(BuildContext context) {
assert(context.mounted, 'The context must be mounted');
final widget = context.findAncestorWidgetOfExactType<Data<T>>();
if (widget == null) {
return null;
}
return widget.data;
}