fluent_result 8.5.0
fluent_result: ^8.5.0 copied to clipboard
A fluent Result type for Dart that returns success/failure instead of throwing, with a global observability seam for crash reporting.
8.5.0 #
- [Add] Global observability seam
ResultConfig.onException(no-op by default) — the single place to wire crash reporting (e.g. Sentry). Unexpected caught exceptions are reported exactly once. - [Add]
ResultMatcher+ResultConfig.matchers: ordered, subtype-aware error classification with anexpectedflag (expected errors are never reported). - [Add]
ResultConfig.onSuccess,failBuilder, andreset()(call in testtearDownto avoid global-config leakage). - [Add]
onErrorWithStackparameter ontrySync/tryAsync. - [Add]
ResultOf.guard/guardAsyncto wrap a plain value-returning body. - [Add] Combinators on
ResultOf<T>:flatMap,flatMapAsync,match,valueOr,getOrElse,recover,mapError. - [Change]
failIf/okIfroute throughfailBuilder— validation failures are never reported. - [Change]
fail/failWithreturnResultOf<T>(wasResultOf<T?>) — covariant, non-breaking. - [Change] Caught and successful results are no longer logged by default; the default
exceptionHandlerMatchersis now empty. - [Change] SDK lower bound raised to
>=2.14.0. - [Deprecate]
exceptionHandler,exceptionHandlerMatchers,logSuccessResult— still honored, but preferonException+matchers+onSuccess. - [Remove]
loggerandquiverdependencies. - [Docs] add a runnable
example/, fill the public API dartdoc, and add pub.dev metadata (topics,repository,issue_tracker, correcteddescription).
Migration
- If your
ResultConfig.exceptionHandlerreported errors itself, move that reporting intoResultConfig.onExceptionto avoid double-reporting. failIf/okIfnow route throughResultConfig.failBuilderinstead ofexceptionHandler; if you customizedexceptionHandlerto shape their output, setfailBuilderinstead.- For
Error-derived third-party exceptions (e.g.DioError extends Error), match with(e) => e is Error— thee is Exceptioncatch-all does not match them.
8.4.1 #
- [Fix]
Result.hashCodeis now stable and contract-correct, so equal Results share a hash code and work asSet/Mapkeys - [Fix]
ResultOf.map()no longer drops all but the first error when mapping a multi-error fail result - [Fix]
foldWithValue/mapthrow a clearStateErrorinstead of an opaqueTypeErrorwhen a non-nullable success value isnull - [Docs] correct README
exceptionHandlerMatchersmatcher signature, nullableResultOf.value, andResult.failWithusage
8.4.0 #
- [Fix] can pass
nullinsuccessWith(null)
8.3.0 #
- add
onFinallymethod toResultOfandResult - update
loggerdependency to^2.2.0
8.2.0 #
- update
loggerdependency
8.1.0 #
- downgrade
collection: ^1.17.1
8.0.0 #
- [Fix] logging stack trace.
- [Update] dependencies.
7.2.0 #
- [Add] exception handler matchers.
7.1.1 #
- [Add] onError in
trySync/tryAsyncfor error handler customization.
7.1.0 #
- [Add] logSuccessResult into
ResultConfig - [Change] errorMessage now is non-nullable, by default is empty string.
7.0.0 #
- [Add]
ResultConfigto customizeexceptionHandler - [Fix]
tries
6.0.0 #
- [Add]
success,successWith,failmethods - [Add]
trySync,tryAsyncmethods - [Change]
toResultintomap
5.0.0 #
Breaking changes
ResultErrorhas not const constructor anymore.
Updates
- Use
withErrorandwithErrorsinstead offailandfailsrespectively. - [Add] folding onFail and onSuccess with
fold(onFail, onSuccess). - [Add] mapping any object to
ResultOf<T>withtoResult(). - [Add]
failIf(condition, reason)andokIf(condition, failReason).
4.3.0 #
- [Fix]
contains<T>() - [Add] getting specific error from collection by
get<T>
4.2.0 #
- [Fix]
contains<T>()
4.1.0 #
- [Add] errors collection
4.0.1 #
- [Migrate] to null-safety
4.0.0 #
- [Update] dependencies for migration to null-safety
3.0.2 #
- Add
withErrorMessage(String)method toResultOf - Add
withException(Exception)method toResultOf
3.0.1 #
- [Add]
withErrorMessage(String)method toResult - [Add]
withException(Exception)method toResult
3.0.0+1 #
Correct README.md
3.0.0 #
- [Add]
ResultErrorobject that describes a error and allows the errors to be typed.
2.0.0+1 #
Correct README.md
2.0.0 #
- [Add]
ResultOf<T>for generic Result to hold value of T. - [Remove]
flutterdependency
1.0.0+1 #
- [Add] correct description
1.0.0 #
Initial Version of the library.
- Includes the ability to create Success and Fail Results
- Includes the ability to create Generic Result with value