manager<T extends FlutterStyleSheet> static method

SheetManager<T> manager<T extends FlutterStyleSheet>(
  1. BuildContext context, {
  2. bool listen = false,
})

Implementation

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