clean_signals 2.1.0
clean_signals: ^2.1.0 copied to clipboard
A lightweight use-case and controller framework for signals-based Flutter and Dart applications. Typed results, sealed failures, ref-counted activity tracking and declarative retries — without rxdart or dartz.
Changelog #
2.1.0 #
Added #
Controller.isDisposed— protected getter exposing the controller's disposal state, so subclasses can guard plain signal writes that follow anawait(if (isDisposed) return;) without re-implementing their own_disposedflag.runIntoandwatchalready guard their own writes; this covers state that doesn't fit theAsyncStateshape (#6).
Fixed #
ActivityTracker.trackno longer writes to its disposed counter signal when a tracked operation is still in flight duringdispose()— an in-flightrun(...)used to throwSignalsWriteAfterDisposeErrorfrom itsfinallyblock when the controller was disposed mid-operation.
2.0.0 #
Renamed from base_core to clean_signals (the original name was taken
on pub.dev). Update imports to package:clean_signals/clean_signals.dart.
Complete rewrite. The package is now pure Dart (no Flutter SDK dependency) and built on signals instead of rxdart; dartz has been removed entirely.
Added #
Result<T>— sealedSuccess/Failedunion withfold,map,flatMap,getOrElse,Result.guard, andtoAsyncState()bridging into signals'AsyncState.Controller— signals-based view-model base class withrun,runInto,watch, ref-countedisLoading, a broadcastfailuresstream,autoEffectandonDisposelifecycle cleanup.RetryPolicy— per-call declarative retries with exponential backoff and aretryIfpredicate (defaults toFailure.isRetryable).ActivityTracker— ref-counted loading state asReadonlySignals.asyncStateSignal<T>()—Signal<AsyncState<T>>seeded with loading.Failure.cause/Failure.stackTrace/Failure.isRetryable;FailureimplementsExceptionso it can be thrown from lower layers and captured byUseCase.call.example/— a full clean-architecture Flutter sample app (Team Directory).
Changed #
UseCase.executereturnsFuture<Result<R>>;callguards against all thrown errors, converting them toFailedresults.StreamUseCase(renamed fromStreamingUseCase) emitsResultevents and converts stream errors intoFailedevents without breaking cancellation.
Removed #
- dartz (
Either,Tuple2,Trampoline) and rxdart dependencies. DataManager,UseCaseGenerator,UseCaseExecutor,StreamingUseCaseManagerand the type-keyedrunUseCase<U, P>registry — replaced byControllerwith directly-invoked, fully typed use cases.BaseBloc,BlocProvider,MultiBlocProvider,BaseState,ValueStreamBuilder,match— use signals'SignalBuilderand a DI container (e.g. get_it) instead.RetryableFailureand the global retry loop — replaced byRetryPolicy.
1.0.0 #
- First release.