ApiService is the main class to use to make API calls. This use
an instance of Dio (possibly created using DioClient) and has several
methods to automatize data extraction
A cubit state representing an error. CubitErrorState can track the
originating error as well the stack trace. Each time a new CubitErrorState
is created, it is streamed into CubitErrorState.stream so that you could
implement a global error tracker/logger.
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:
An ObjectCubit is an implementation of a Cubit designed to handle the
lifecycle of a single object. This is specifically effective to track
business objects as you might want to update them while still tracking the
same Cubit.
ObjectCubit ensures that you can get the last version registered version
of the tracked object at anytime, regardless of the current cubit state.
ObjectCubit uses two generic types:
A simple widget to rebuild the whole app tree from a BuildContext.
Wrap your main widget (typically "MyApp") with this and simply call
Phoenix.rebirth(context) to rebuild the whole app.
CompletableMixin is an extension allowing you to seamlessly add a whole
screen loader on your page. Assign a value to loadingDialogCompleter to
display your loader, then call waitForDialog in order to dismiss it.
A simple loader that can be used in conjunction with CompletableMixin.
Displays a simple AlertDialog that covers the whole screen until dismissed.
User cannot dismiss it from screen touch or back press.
A simple loader that can be used in conjunction with CompletableMixin.
Displays a translucent barrier that covers the whole screen until dismissed.
User cannot dismiss it from screen touch or back press.
This is a generic class to handle and display errors across your app.
APIError helps you track errors coming from API call and display an error
message accordingly. It also maintain the original Exception as well as the
stack trace