When you use BlocProvider , it ctreates its own context. The context inside button is reffering to the TempScreen.
BlocProvider creates a new subtree, and the outer context does not contain the new provider. So context.read<TempScreenCubit>() is using the wrong BuildContext.
The correct context is the one inside the BlocProvider subtree, not the one from TempScreen’s build method.