of static method

Thin wrapper of Provider.of

Implementation

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