of<T extends BlocstarLogicBase<BlocstarContextBase?>> static method

T of<T extends BlocstarLogicBase<BlocstarContextBase?>>(
  1. BuildContext context
)

Implementation

static T of<T extends BlocstarLogicBase>(BuildContext context) {
  final type = _providerType<BlocProvider<T>>();
  final BlocProvider<T>? provider = context.findAncestorWidgetOfExactType<
      BlocProvider<T>>(); //context.ancestorWidgetOfExactType(type);
  if (provider == null) {
    throw new Exception("Could not find provider for bloc of type $type");
  }
  return provider.bloc;
}