getState<St> method

St getState<St>()

Get the state, without a StoreConnector. Note: Widgets that use this method will rebuild whenever the state changes.

It's recommended that you define this extension in your own code:

extension BuildContextExtension on BuildContext {
  AppState get state => getState<AppState>();
}

This will allow you to write:

var state = context.state;

Implementation

St getState<St>() => StoreProvider.state<St>(this);