doso 2.0.0
doso: ^2.0.0 copied to clipboard
DoSo is a lightweight Dart library for simple and elegant error and state handling, designed to reduce boilerplate and avoid code generation in Flutter apps.
2.0.0 #
Breaking changes.
Do.failurenow requires its failure value.Do.failure()built aFailureholdingnull, whichfold,whenandmaybeWhenreached through_failure as Fand threw at runtime. For a failure with no detail, type it asDo<Exception?, T>and passnull.onCatchintryCatchreceives anObjectinstead of anException. Callbacks with inferred parameter types are unaffected.tryCatchno longer casts its default failure toF. The caught error is kept whenFaccepts it, wrapped in anExceptionwhen that fits, and aDoExceptionwith the newDoExceptionType.unsupportedFailureTypeis thrown otherwise.whenno longer falls back to() {} as Ton the initial state.onInitialremains optional and now defaults toonLoading.SuccessandFailuredeclare their value as non-nullable.
Additions.
SoAsync<F, S>andSoExceptionAsync<S>for operations that are always asynchronous, andSoSync<F, S>andSoExceptionSync<S>for operations that never are.SoandSoExceptionstayFutureOrand are unchanged; the new aliases remove theas Future<Do<...>>cast thatFuture.waitand otherFuturemembers forced on callers.
1.1.2 #
- Fixed
tryCatchmethod when onCatch is null.
1.1.1 #
- Added missing
orElseinmaybeWheninterface.
1.1.0 #
- Added
maybeWhenmethod to handle specific states.
1.0.0 #
- Initial stable release