suppose that we navigate to "PageA" using the following code:
Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return BlocProvider(
create: (context) => BlocA(),
child: PageA(),
);
},
),
);
when "PageA" navigates to "PageB". how can I access "BLocA"? I have tried following code to navigate from "PageA" to "PageB" but it crashes.
Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return BlocProvider(
create: (context) => contxt.read<BlocA>(),
child: PageB(),
);
},
),
);