of<T extends Disposable> static method

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

Thin wrapper of Provider.of

Implementation

static T of<T extends Disposable>(BuildContext context) {
  try {
    return Provider.of<T>(context, listen: false);
  } catch (error) {
    throw FlutterError(
      '''
      DisposableProvider.of() called with a context that does not contain
      a Disposable of type $T.
      The context used was: $context
      Error: $error
      ''',
    );
  }
}