abstract_bloc
3.2.0, released 6 months ago by an unverified publisher
Abstract base classes and widgets for implementing BLoC pattern with pagination, items, and forms.
WASM-ready
What it does
Provides abstract base classes and ready-to-use widgets for common flutter_bloc use cases including paginated lists, single items, and forms with validation. It standardizes data flow with features like cache-first strategies, snapshot/revert states, and event bus integration.
AI-written summary of version 3.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are using flutter_bloc and want to reduce boilerplate for paginated lists, detail items, and validated forms
- You need built-in cache-first data loading strategies with local or remote fallback
- You want standardized UI widgets that automatically handle loading, error, and empty states for lists and forms
Skip it when
- You prefer Riverpod or Provider for state management
- You need completely custom state architectures that do not fit the list/item/form abstraction pattern
Strengths
- Eliminates boilerplate for common BLoC patterns like pagination and forms
- Includes ready-to-use UI builder widgets with built-in state handling
- Supports cache-first strategies and snapshot/revert state patterns out of the box
Weaknesses
- Tightly coupled to flutter_bloc and specific package base classes
- Opinionated structure may feel restrictive for highly customized data flows
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 4
not documented
class UsersCubit extends AbstractListCubit<UsersState> {
final UsersRepository _repository;
UsersCubit(this._repository) : super(_initialState());
@override
Future<Result<GridResult<User>>> resolveData() {
return _repository.getUsers(state.searchModel);
}
}Alternatives
Packages that do the same job and could replace abstract_bloc.
Works with
Packages commonly used together with abstract_bloc: ones it builds on, ones built on it, and its own family.
- flutter_blocabstract_bloc depends on itFlutter widgets to easily integrate blocs and cubits for state management.
- providerabstract_bloc depends on itA lightweight wrapper around InheritedWidget for state management
- rest_api_clientabstract_bloc depends on itHTTP client for REST APIs with JWT authentication, automatic token refresh, and response caching.