简体   繁体   中英

Bloc Pattern- Flutter - how to pass state from one screen to another in bloc pattern

In bloc pattern architecture is there any difference to send state from one screen to another without bloc pattern as i know we call the next screen using any navigation and pass state as parameter in the constructor of nextScreen like below:

Navigator.push(
context,
 MaterialPageRoute(
   builder: (context) =>
      ServiceExpandScreen(serviceName:serviceName)),);

so with bloc pattern do we need to change anything in above code or is there any better way with bloc pattern?

if your next page needs the information stored in the current page's bloc. so you have to listen to the bloc on the next page to access data. otherwise passing data using the constructor is a good option too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM