BlocProvider.of() called with a context that does not contain a Bloc of type CLASS

No need to access loginListingBloc from context since it exists in the current class and not up the widget tree.

change:

BlocProvider.of<LoginListingBloc>(context).dispatch(LoginEvent(loginInfoModel: testLogin));  

to:

_loginListingBloc.dispatch(LoginEvent(loginInfoModel: testLogin));

For all others who come here for the error message: Make sure you always specify the types and don't omit them:

BlocProvider<YourBloc>(
    create: (context) => YourBloc()
    child: YourWidget()
);

and also for

BlocProvider.of<YourBloc>(context);

Tags:

Flutter

Bloc