Skip to content
pubscout

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
$ flutter pub add leancode_cubit_utils
Source repository

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.

  • bloc

    If you want raw state management without opinions on request and pagination abstractions.

Works with

Packages commonly used together with leancode_cubit_utils: ones it builds on, ones built on it, and its own family.