of<S> static method

Store<S> of<S>(
  1. BuildContext context
)

Implementation

static Store<S> of<S>(BuildContext context) {
  final widget = context
      .dependOnInheritedWidgetOfExactType<_InheritedStoreProvider<S>>();

  if (widget == null) {
    throw Exception(
        'Couldn\'t find a StoreProvider of the correct type ($S).');
  } else {
    return (widget).store;
  }
}