Suppose I have a create invoice screen which have different sections. Like customer details, bill to , ship to, list of product, payment details, tax section, Other charges section. Do I use seprate bloc for each section or one bloc for all sections? If I use one bloc then how to implement blocbuilder build method since a lots of state will be there. If I use multiple bloc then how can get all data from different bloc to submit on server?
I am using bloc with freezed.
2
Answers
In this case the better option is that you have a multibloc provider when you intance you provider change a multibloc of this form you coulded do uses the multi bloc in only view
and you can used it like this
it depends on your requirements.
you have Invoice screen with different sections like customer details, bill to, ship to, list of product, payment details, tax section and other. so main reason to extract logic for some section in to separate bloc is if you use it in some other place in your app. for example, if you use Payment details in profile or separate PaymentScreen, or else where, it is good to have separate PaymentsBloc in this case.
and then in InvoicScreen
You are free to add more blocs to separate other sections.
more info in documentation.