domain_error 2.0.0 copy "domain_error: ^2.0.0" to clipboard
domain_error: ^2.0.0 copied to clipboard

Domain errors with Either, Result, and executeSafely for expected errors in Dart applications.

Changelog #

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Unreleased #

2.0.0 - 2026-08-30 #

Changed #

  • ExecuteSafelyOptions: onError is now onDomainError, onThrown is now onRawError, and mapThrownToError is now mapRawErrorToDomain. The options type is no longer generic and no longer extends Equatable.
  • DomainError.error is now rawError.
  • Either is sealed. The error branch is isErr / errValue / Either.err. The success branch is isOk / successValue / Either.ok.
  • fold now takes ifErr and ifOk. when is removed. map maps the success value and leaves an error unchanged.
  • domainError is available only on Result<T>, not on a generic Either.
  • executeSafely now returns Future<Result<T>>. FutureOrResult is removed.

1.0.0 - 2026-08-30 #

Added #

  • DomainError base type with a stable typeIdentifier, optional message, error, and stackTrace.
  • Either with failure and value branches, plus fold, when, and map.
  • Result, FutureResult, and FutureOrResult as Either aliases over DomainError.
  • executeSafely to catch throws and return a Result.
  • ExecuteSafelyOptions with mapThrownToError, onError, and onThrown.
1
likes
0
points
285
downloads

Publisher

unverified uploader

Weekly Downloads

Domain errors with Either, Result, and executeSafely for expected errors in Dart applications.

Repository (GitHub)
View/report issues

Topics

#error-handling #domain #exceptions

License

unknown (license)

Dependencies

collection, equatable, meta

More

Packages that depend on domain_error