Which flutter bloc widget to use if i want to add an item to list in bloc class and automatically update the UI on the basis of items of that list without the use of states (without yielding a state upon addition of new item to the list)? In another words, how to get same functionality as notifyListeners() function from provider package?
Asked
Active
Viewed 385 times
0
-
The whole point of `flutter_bloc` is managing state. If you want the same as the providers package, why not use it? – nvoigt Sep 28 '20 at 11:14
-
no i dont mean the state as whole but without yielding the states upon each addition of the item to the list. it will be difficult to maintain two state management package in a single app so. – Manish Wagle Sep 28 '20 at 11:19
-
Well, then use only one? I don't really see the problem. Why not yield a new state every time you add something? It can be the same class, same state, just with new data (for example the updated list). – nvoigt Sep 28 '20 at 11:23
-
yeah, there would be no problem doing that but i was wondering if there is some another work around which does the same work just without using any state classes. – Manish Wagle Sep 28 '20 at 11:25
1 Answers
1
The flutter_bloc
package includes the lightweight Cubit<>
class that is basically what you want: a bloc without extra states.
You can read all about cubits in the official documentation for flutter_bloc
.

nvoigt
- 75,013
- 26
- 93
- 142