softcore 1.0.0
softcore: ^1.0.0 copied to clipboard
A thin, predictable state layer on top of flutter_bloc: typed DataState, a BaseCubit for requests and one-shot actions, caching, observers, and widgets that render loading, error and data with overrid [...]
1.0.0 #
A rewrite focused on reliability and a small, predictable API. It now depends
only on flutter_bloc (8.x or 9.x) and works on every platform, web included.
Added #
BaseCubit<T>withload(latest request wins, optional cache with TTL),runAction(returns anActionResult, never throws), andemitLoading,emitData,emitError,emitState,updateDatato manage state by hand.DataStatesplit into screen states (DataInitial,DataLoading,DataSuccess,DataFailed) and one-shot action states (ActionLoading,ActionSuccess,ActionFailed). Both families are open for your own subclasses, and all states have value equality.DataObserverandBaseCubit.observefor sections of a screen that load independently, rendered withDataObserverBuilder.SoftBlocConsumer,SoftBlocListener,SoftBlocPage,DataStateView.SoftCore/SoftCoreConfigto set loading, error, initial and progress views, the error messenger and anErrorMapperonce for the whole app.SoftExceptionandLocalizedExceptionfor user-facing errors.
Fixed (compared with 0.x) #
- A slow earlier request no longer overwrites a newer one.
- Nothing is emitted after the cubit is closed; observers are closed with it.
- Action errors no longer escape as unhandled exceptions.
- The progress dialog always closes, and closes only itself, never a dialog or page opened on top of it.
- Pages no longer reload on every rebuild.
- Adding a custom listener no longer turns off progress and error handling.
- Errors no longer depend on
Get.contextor crash aboveMaterialApp. - String errors and Arabic/English messages are shown correctly.
Breaking changes #
- Removed the GetX, get_it, Dio, retrofit, injectable and UI-kit
dependencies and widgets. Map Dio (or any) errors with an
ErrorMapper. - State names changed:
UnInitState→DataInitial,LoadingStateListener→ActionLoading,SuccessStateListener→ActionSuccess,FailureStateListener→ActionFailed,DataStateFBuilder→BuildState,DataStateFListener→ActionState. executeEmitterData→load,executeEmitterListener→runAction,executeEmitterObserver→observe,findObserver→observer.MaterialBlocWidget→SoftBlocPage;StreamDataStateWidget→DataObserverBuilder.- Cache keys are explicit strings (
cacheKey:) instead of type hash codes.
0.2.0 #
- Initial public release.