Skip to content

v9.0.0

Latest

Choose a tag to compare

@AndrewPiterov AndrewPiterov released this 28 Jun 11:43
1c1ced5

Breaking major. The core is now a Dart 3 sealed Result<T> — Ok<T> (non-null value) / Err<T> (single ResultError) — with compiler-enforced exhaustive switch and no more value!. The onException observability seam and mapper-free tryAsync are preserved.

Added

  • Sealed Ok/Err variants; exhaustive switch; value-based, symmetric ==/hashCode; immutable results.
  • Non-null Ok.value; read via pattern matching / valueOrNull / valueOr / fold / match.
  • ResultError.code / cause / stackTrace (the caught-exception path now lands the stack in the Err); runtimeType in equality.
  • Error-rethrow policy: an unmatched thrown Error reaches the Zone / crash reporter; claim it with a ResultMatcher to convert to Err.
  • Combinators: map, flatMap, flatMapAsync, value-returning fold / match, valueOr, getOrElse, recover, mapError, Err.cast<R>.

Removed (breaking)

  • ResultOf<T> (→ Result<T>), asResult, multi-error (errors/add/addAll/contains/get), ResultException, the deprecated 8.5 exceptionHandler/exceptionHandlerMatchers/logSuccessResult, the ResultConfig() factory, and the void fold({onFail,onSuccess}) form.
  • The collection dependency — zero runtime dependencies. SDK floor >=3.0.0.

See the CHANGELOG and the README's 8.5 → 9.0 migration table.