Here is the main page:
child: BlocProvider(
create: (_) => WelcomeCubit(context.read<AuthenticationRepository>()),
child:
WelcomeForm(),
And in the WelcomeForm
return BlocListener<WelcomeCubit, WelcomeState>(listener: (context, state) {
print("BlocListener " + state.status.toString());
if (state is newPage){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => BlocProvider<WelcomeCubit>.value(
value: welcomeCubit,
child: SmsVerifyPage(),
))); }
On the SmsVerifyPage :
@override
Widget build(BuildContext context) {
SizeConfig().init(context);
return BlocBuilder<WelcomeCubit, WelcomeState>(
buildWhen: (previous, current) => previous.otp != current.otp,
builder: (context, state) {
print(state.status.toString());
> print(state.phone.value); /////// <--------------- this value is always null.
return Scaffold();}
I may be trying wrong at this point, I guess. but I couldn't find a solution to solve this. I referred all flutter bloc recipes but in vain I couldn't find one.
Thanks for any solution and suggestions.