verdict 1.1.0
verdict: ^1.1.0 copied to clipboard
A sealed Result type and a structured Failure hierarchy for Dart, so calls return a typed verdict instead of throwing across layer boundaries.
1.1.0 #
Additive only — nothing in 1.0.0 changed shape, so the upgrade is a version bump.
-
Lowered the minimum Dart SDK to
>=3.0.0 <4.0.0. 1.0.0 required^3.13.0, but nothing in the package uses a language feature newer than Dart 3.0's sealed classes and pattern matching, so the bound was far stricter than the code needed. Widening it is not breaking: every 1.0.0 consumer still resolves. -
Floated the dependency bounds —
equatable: '>=2.0.0 <3.0.0'— so upgradingverdictno longer forces the rest of a resolution forward. -
ResultgainedmapFailure,recover,recoverWith,getOrElseWith,valueOrThrow, theonOk/onErrside-effect taps, themapAsync/flatMapAsyncasync counterparts, and theResult.ok/Result.errconstructors. -
Result.collectturns anIterable<Result<T>>into aResult<List<T>>, short-circuiting on the first failure. -
flatten()collapses a nestedResult<Result<T>>. -
A
FutureResultextension mirrors the whole surface onFuture<Result<T>>, so an async pipeline chains forwards instead of nestingawaits. -
FailureExceptioncarries aFailureacross a throwing boundary; it is whatvalueOrThrowthrows. -
Failuregained optionalcauseandstackTracediagnostics, and every variant gainedcopyWith. Both new fields are excluded from equality, so failures compare the same whether or not the original error was kept. -
DefaultFailureMappernow records the error and its trace ascauseandstackTrace. -
The
mapperargument ofguard/guardSyncis now optional and defaults toDefaultFailureMapper.
1.0.0 #
First stable release. The API is unchanged from 0.1.0 and is now covered by
semantic versioning: no breaking change to Result, Failure, the mappers,
guard or failureOrigin will land outside a 2.0.0.
- Breaking: raised the minimum Dart SDK to
^3.13.0, the version Flutter 3.47.0 ships. Stay on 0.1.0 if you need Dart 3.6–3.12.
0.1.0 #
Initial release.
Result<T>— a sealed type that is eitherOk<T>orErr<T>, withmap,flatMap,fold,getOrElse,valueOrNullandfailureOrNull.Unit/unitfor operations whose success carries no payload.Failure— a sealed hierarchy ofApiFailure,NetworkFailure,AuthFailure,CancelledFailureandUnknownFailure, each carryingtitle,messageand optionalreferenceIdandcode.FailureMapper/ChainedFailureMapper/CompositeFailureMapper/DefaultFailureMapperfor turning SDK-specific errors intoFailures without the package itself depending on any SDK.guardandguardSyncto convert a throwing body into aResult.failureOriginto label a failure with the call site that produced it.