common/bloc/cubit_manager
library
Classes
-
CubitManager<C extends Cubit, T, I>
-
A CubitManager is a factory for a single Cubit type. It handles the
lifecycle of the cubits of a specific type by assigning id to each instance.
This is handy when you want to ensure that only one cubit of each id is
used across your app.
A classic use case could be managing posts cubits inside and app, with posts
objects that can be edited as the app runs. CubitManager will ensure that
only one cubit is associated to a specific post (given a unique post ID).
While using CubitManager, you may not want the cubits to be automatically
closed by widgets such as BlocProvider. Be sure to always use
BlocProvider.value instead of the default constructor, as the latest
internally handle the created cubit lifecycle.
CubitManager needs three generic types in order to be instanced: