of<VM extends PulseXStreamViewModel> static method

VM? of<VM extends PulseXStreamViewModel>(
  1. BuildContext context
)

Call PulseXStreamStateManager.of method if you don't wanna make an object of PulseXStreamStateManager again It will throw error if PulseXStreamViewModel of exact type So be ensure that PulseXStreamViewModel has been instantiated first Note: PulseXStreamViewModel is intended only for stream data

Implementation

static VM? of<VM extends PulseXStreamViewModel>(BuildContext context) {
  final provider = context
      .dependOnInheritedWidgetOfExactType<PulseXStreamStateManager<VM>>();
  if (provider == null) {
    PulseXErrors.streamManagerNotFoundError(VM);
  }
  return provider?.viewModel;
}