watch<T extends Bloc> static method

T watch<T extends Bloc>(
  1. BuildContext context
)

Similar to the WatchContext.watch method from the Provider package.

Blocs normally won't automatically redraw the Widget that calls them, unless you specifically watch the BlocNotifier. This is a helper function to remove the boilerplate of retrieving the BlocNotifier and unwrapping it.

Implementation

static T watch<T extends Bloc>(BuildContext context) =>
    context.watch<BlocNotifier<T>>().bloc;