Setup and features
Bloc Superpowers is a Flutter/Dart package created by Marcelo Glasberg, available on pub.dev since Jan 2026. Click here to visit the package page, and here to see all my 17+ packages in pub.dev.
In pubspec.yaml
Section titled “In pubspec.yaml”dependencies: bloc_superpowers: ^1.0.0 # Check the latest version flutter_bloc: ^9.1.1 # Check the latest version fast_immutable_collections: ^11.1.0 # Optional, if you want to use IListIn your widget tree
Section titled “In your widget tree”Add widget Superpowers near the top of your widget tree,
somewhere above your MaterialApp:
Widget build(BuildContext context) { return Superpowers( ... child: MaterialApp( ...Note: Failing to add the
Superpowerswidget will result in runtime errors when you useisWaiting,isFailed, orgetExceptioncontext extensions. All the rest will still work.
List of features
Section titled “List of features”-
context.isWaiting(): Use it to show spinners or loading indicators when a Cubit is loading. No need to add explicit loading states to your Cubits anymore. -
context.isFailed(): Show error messages when a Cubit has failed. No need to add explicit error states and error messages to your Cubits anymore. -
UserException: A Cubit that fails can now just throw exceptions. -
UserExceptionDialogandUserExceptionToast: Widgets that shows an error dialog or toast when a Cubit throws a UserException. -
retry: Easily retry failed Cubit methods. -
checkInternet: Check for internet connectivity before executing Cubit methods. -
nonReentrant: Prevent Cubit methods from being called simultaneously. -
sequential: Queue Cubit method calls and process them one after another, in order. -
fresh: Treat Cubit methods as fresh for some time. Prevent reloading data too often. -
debounce: Debounce Cubit method calls to avoid rapid successive calls. -
throttle: Throttle Cubit method calls to limit how often they can be called. -
catchError: Suppress errors, rethrow them, or wrap them in user-friendly exceptions. -
MixConfig: Create reusable configurations for themixfunction. -
MixPreset: Create your own reusablemixfunctions. -
optimisticCommand: Applying an optimistic state change immediately, then run the command on the server, optionally rolling back and reloading. -
optimisticSync: Update the UI immediately and send the updated value to the server, making sure the server and the UI are eventually consistent. -
optimisticSyncWithPush: Similar to optimisticSync, but resilient to server-pushed updates that may modify the same state this action controls. -
Effect: Class that allows Cubits to emit one-time effects to the UI, such as navigation events, dialogs, toasts. ReplacesBlocListener. -
EffectQueue: Class that allows Cubits to emit queued one-time effects to the UI, ensuring they are shown one after the other.