of<VM extends PulseXBaseViewModel> static method

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

Call PulseXStateManager.of method if you don't wanna make an object of PulseXStateManager again
It will throw error if PulseXBaseViewModel of exact type So be ensure that PulseXBaseViewModel has been instantiated first

Implementation

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