of<T extends BlocStream> static method

T of<T extends BlocStream>(
  1. BuildContext context
)

Implementation

static T of<T extends BlocStream<dynamic>>(BuildContext context) {
  try {
    return Provider.of<T>(context, listen: false);
  } on ProviderNotFoundException catch (_) {
    throw FlutterError(
      '''
      BlocStreamProvider.of() called with a context that does not contain a BlocStream of type $T.
      No ancestor could be found starting from the context that was passed to BlocStreamProvider.of<$T>().

      This can happen if the context you used comes from a widget above the BlocStreamProvider.

      The context used was: $context
      ''',
    );
  }
}