Bloc: Number of bloc/cubits per screen

Created on 13 Aug 2020  路  2Comments  路  Source: felangel/bloc

Is your feature request related to a problem? Please describe.
How many blocs/cubits I need to create if I get data from n i.e rest api in one screen

question

All 2 comments

Hi @II11II 馃憢

It certainly depends on how you plan on showing that data and the different states involved, but most of the time you would end up needing a single bloc/cubit and sending those n requests with a Future.wait.

Hi @II11II 馃憢
Thanks for opening an issue!

When thinking about how many blocs/cubits I would avoid thinking about the data layer and think about the feature/use-case. Generally, you should have one bloc/cubit per feature regardless of the number of http requests, etc...

Hope that helps 馃憤

Was this page helpful?
0 / 5 - 0 ratings