leancode_cubit_utils
0.5.0, released 10 months ago by leancode.co
Cubits and widgets to eliminate boilerplate for single requests and paginated pages.
WASM-ready
What it does
Provides specialized cubits like RequestCubit and PaginatedCubit alongside accompanying UI builders to handle loading, refreshing, error, and empty states for API requests and infinite scrolling lists.
AI-written summary of version 0.5.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- Building pages that perform single HTTP or CQRS requests with loading, error, and success states.
- Implementing paginated lists with infinite scrolling and automatic next-page fetching.
- Eliminating repetitive state management boilerplate around Bloc/Cubit async calls.
Skip it when
- Not using the flutter_bloc ecosystem or state management architecture.
- Building simple local UI state that doesn't involve asynchronous network requests.
Strengths
- Reduces boilerplate for standard request-response and pagination flows.
- Built-in request deduplication, caching, and refresh support.
- Global configuration provider for default loaders, error widgets, and request modes.
Weaknesses
- Tied strictly to the bloc/cubit state management pattern.
- Requires writing custom subclasses and mappers for each request type.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 6
RequestCubitBuilder(
cubit: context.read<ProjectDetailsCubit>(),
onLoading: (context) => const Center(child: CircularProgressIndicator()),
onSuccess: (context, data) => ListView(children: [Text(data.id)]),
)Alternatives
Packages that do the same job and could replace leancode_cubit_utils.
Works with
Packages commonly used together with leancode_cubit_utils: ones it builds on, ones built on it, and its own family.
- asyncleancode_cubit_utils depends on itUtility classes and helpers that extend Dart's async library.
- loggingleancode_cubit_utils depends on itProvides configurable logging with levels and stream listeners for Dart apps.
- equatableleancode_cubit_utils depends on itProvides value‑based equality for Dart objects without manual == and hashCode.
- flutter_blocleancode_cubit_utils depends on itFlutter widgets to easily integrate blocs and cubits for state management.
- providerleancode_cubit_utils depends on itA lightweight wrapper around InheritedWidget for state management
- leancode_hooksleancode_cubit_utils depends on itA collection of utility hooks for Flutter, including BLoC integration and controllers.
- leancode_lintSame familyAn opinionated set of high-quality, robust, and up-to-date lint rules used at LeanCode.