of<T extends MastroBox<MastroEvent> > static method
Retrieves the MastroBox of type T from the widget tree.
Implementation
static T of<T extends MastroBox>(
BuildContext context, {
bool listen = false,
}) {
try {
return Provider.of<T>(context, listen: listen);
} on ProviderNotFoundException catch (e) {
if (e.valueType != T) rethrow;
throw FlutterError(
'''
BoxProvider.of() called with a context that does not contain a $T.
No ancestor could be found starting from the context that was passed to BoxProvider.of<$T>().
This can happen if the context you used comes from a widget above the BoxProvider.
The context used was: $context
''',
);
}
}